Skip to content

Commit 55e99e7

Browse files
committed
3.0.0
1 parent 36ed6ec commit 55e99e7

26 files changed

+2656
-32
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ build/
55
out/
66
classes/
77

8+
# Claude
9+
.claude/
10+
811
# eclipse
912

1013
*.launch

FAME_API_GUIDE.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Fame Power API - Integration Guide
2+
3+
This guide explains how to integrate the Fame Power system into external mods (e.g., dungeon mods).
4+
5+
## API Method
6+
7+
```java
8+
io.icker.factions.FactionsMod.addFamePower(UUID playerUUID, int amount)
9+
```
10+
11+
## Parameters
12+
13+
| Parameter | Type | Description |
14+
|-----------|------|-------------|
15+
| `playerUUID` | `UUID` | The UUID of the player who earned the fame |
16+
| `amount` | `int` | Fame power to grant |
17+
18+
## Return Value
19+
20+
| Value | Meaning |
21+
|-------|---------|
22+
| `> 0` | Actual amount added to faction (may be less if near max) |
23+
| `0` | Player has no faction, or faction already at max fame |
24+
25+
## Example Usage
26+
27+
```java
28+
import io.icker.factions.FactionsMod;
29+
import java.util.UUID;
30+
31+
// When player completes a dungeon:
32+
public void onDungeonComplete(ServerPlayerEntity player, String dungeonDifficulty) {
33+
int fameReward = switch (dungeonDifficulty) {
34+
case "easy" -> 5;
35+
case "normal" -> 10;
36+
case "hard" -> 20;
37+
case "legendary" -> 35;
38+
default -> 5;
39+
};
40+
41+
int added = FactionsMod.addFamePower(player.getUuid(), fameReward);
42+
43+
if (added > 0) {
44+
// Notify player their faction gained fame
45+
player.sendMessage(Text.literal("Your faction gained " + added + " fame power!"));
46+
}
47+
}
48+
```
49+
50+
## Configuration (Server-side)
51+
52+
Server admins can adjust these values in `config/factions.json`:
53+
54+
```json
55+
"fame": {
56+
"maxValue": 100,
57+
"decayPerDay": 5
58+
}
59+
```
60+
61+
| Setting | Default | Description |
62+
|---------|---------|-------------|
63+
| `maxValue` | 100 | Maximum fame a faction can accumulate |
64+
| `decayPerDay` | 5 | Fame lost per real day since last gain |
65+
66+
## Dependency Setup
67+
68+
Add Factions as a dependency in your `fabric.mod.json`:
69+
70+
```json
71+
{
72+
"depends": {
73+
"factions": "*"
74+
}
75+
}
76+
```
77+
78+
## Optional: Check if Factions is Loaded
79+
80+
```java
81+
import net.fabricmc.loader.api.FabricLoader;
82+
83+
public void grantFame(ServerPlayerEntity player, int amount) {
84+
if (FabricLoader.getInstance().isModLoaded("factions")) {
85+
FactionsMod.addFamePower(player.getUuid(), amount);
86+
}
87+
}
88+
```
89+
90+
## How Fame Works
91+
92+
- Fame contributes to faction's **total power**
93+
- Higher power allows factions to **claim more territory**
94+
- Fame **decays over time** if the faction stops earning it
95+
- Players can view fame in `/f info` (hover over Total Power)

GODS_BLESSINGS_GUIDE.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# God's Blessings System
2+
3+
Faction leaders can pray to the gods, spending **wealth power** to grant temporary potion effects to all faction members.
4+
5+
## Commands
6+
7+
| Command | Permission | Description |
8+
|---------|------------|-------------|
9+
| `/f gods` | Any player | List all available gods with their effects and costs |
10+
| `/f gods pray <god>` | Leader only | Pray to a god to grant its blessing |
11+
12+
## How It Works
13+
14+
1. **Sacrifice items** to build up wealth power (`/f sacrifice`)
15+
2. **Leaders pray** to a god using `/f gods pray <godname>`
16+
3. **All online members** receive the potion effect immediately
17+
4. **Members who login** while blessing is active get the effect with remaining duration
18+
5. **Death doesn't remove blessings** - effects are reapplied when you respawn
19+
6. Check active blessings with `/f info`
20+
21+
## Default Gods
22+
23+
| God | Effect | Duration | Level | Cost |
24+
|-----|--------|----------|-------|------|
25+
| **Ares** | Strength | 5 min | I | 25 |
26+
| **Athena** | Resistance | 5 min | I | 30 |
27+
| **Hermes** | Speed | 5 min | II | 20 |
28+
| **Apollo** | Regeneration | 3 min | I | 35 |
29+
| **Hephaestus** | Haste | 5 min | II | 15 |
30+
31+
## Limits
32+
33+
- **Cooldown**: 5 minutes between prayers (per faction)
34+
- **Max Active**: 2 blessings can be active at once
35+
- Praying to the same god refreshes its duration
36+
37+
## Tips
38+
39+
- Hover over god names in `/f gods` to see details
40+
- Click a god name to auto-fill the pray command
41+
- Use `/f info` to see active blessings and remaining time
42+
- Coordinate with your faction before important battles!

PLAYER_GUIDE.md

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Factions Update - New Features
2+
3+
## 💪 Player Power & Activity
4+
5+
Each player now contributes **individual power** to their faction based on their activity!
6+
7+
- Every member contributes up to **20 power** (by default) to the faction
8+
- **Inactive players** contribute less power over time:
9+
- 7+ days inactive: 75% power
10+
- 14+ days inactive: 50% power
11+
- 30+ days inactive: 0% power
12+
- Power contribution resets when you **log in**
13+
- Check individual power in `/f info` next to each member's name
14+
15+
---
16+
17+
## 💰 Wealth Power
18+
19+
Factions can gain **Wealth Power** by sacrificing valuable items!
20+
21+
- Use `/f sacrifice` while holding valuable items to sacrifice them
22+
- Sacrifice items like **diamonds**, **diamond blocks**, **netherite ingots**, or **netherite blocks**
23+
- Wealth power **decays over time** if you stop sacrificing
24+
- Maximum wealth power: **100** (by default)
25+
- Check your wealth power by hovering over "Total Power" in `/f info`
26+
27+
---
28+
29+
## ⚔️ War Power
30+
31+
Your faction can earn **War Power** by defeating players from other factions in combat!
32+
33+
- **Earn power** when you kill players from other factions
34+
- **Bonus rewards** for killing members of enemy factions (2x by default)
35+
- War power **decays over time** if your faction stops fighting
36+
- Maximum war power: **100** (by default)
37+
- Check your war power by hovering over "Total Power" in `/f info`
38+
39+
---
40+
41+
## 🏆 Fame Power
42+
43+
Your faction can earn **Fame Power** by completing heroic deeds like finishing dungeons!
44+
45+
- Fame is earned through **special activities** (dungeons, events, etc.)
46+
- Fame power **decays over time** if your faction stops earning it
47+
- Maximum fame power: **100** (by default)
48+
- Check your fame power by hovering over "Total Power" in `/f info`
49+
50+
---
51+
52+
## 🏴 Claim Decay
53+
54+
Claims now require **power to maintain**! If your faction's power drops too low, claims will be lost.
55+
56+
- Each claim requires **5 power** (by default) to maintain
57+
- If your power drops below the required amount, **claims will be removed automatically**
58+
- Claims farthest from your faction home are removed first
59+
- Claims in different dimensions are removed before same-dimension claims
60+
- Check your "Required Power" in `/f info` to see how much power your claims need
61+
62+
### Tips:
63+
- Keep your members active to maintain power
64+
- Sacrifice items regularly to boost wealth power
65+
- Fight enemies to gain war power
66+
- Complete dungeons to earn fame power
67+
- Don't over-expand - only claim what you can defend!
68+
69+
---
70+
71+
## 👑 Vassals & Overlords
72+
73+
Factions can now form **vassal relationships** - a hierarchy where smaller factions serve larger ones.
74+
75+
### How it works:
76+
- A faction can **offer** to become another faction's vassal
77+
- The target faction's leader must **accept** the offer
78+
- Factions must be **mutual allies** before becoming vassals
79+
- Overlords gain a **power bonus** (25% of vassal's power by default)
80+
81+
### Commands:
82+
| Command | Who can use | What it does |
83+
|---------|-------------|--------------|
84+
| `/f vassal info` | Members | View your vassal status |
85+
| `/f vassal offer <faction>` | Leaders | Offer to become their vassal |
86+
| `/f vassal accept <faction>` | Leaders | Accept a vassal offer |
87+
| `/f vassal release <faction>` | Leaders | Release one of your vassals |
88+
| `/f vassal leave` | Leaders | Leave your overlord |
89+
90+
### Rules:
91+
- Only **one level** of hierarchy (no vassal chains)
92+
- Overlords **cannot** become vassals of another faction
93+
- If an overlord faction disbands, all vassals are **automatically released**
94+
95+
---
96+
97+
## 🙏 God's Blessings
98+
99+
Faction leaders can **pray to the gods**, spending wealth power to grant powerful effects to all faction members!
100+
101+
### How it works:
102+
- Leaders use `/f gods pray <godname>` to invoke a god's blessing
103+
- The faction spends **wealth power** as an offering
104+
- **All online members** immediately receive the potion effect
105+
- Members who **login or respawn** while a blessing is active get the remaining duration
106+
- Multiple blessings can be active at once (up to 2 by default)
107+
108+
### Commands:
109+
| Command | Who can use | What it does |
110+
|---------|-------------|--------------|
111+
| `/f gods` | Anyone | List all available gods and their costs |
112+
| `/f gods pray <god>` | Leaders | Pray to a god to grant its blessing |
113+
114+
### Default Gods:
115+
| God | Effect | Duration | Level | Cost |
116+
|-----|--------|----------|-------|------|
117+
| **Ares** | Strength | 5 min | I | 25 |
118+
| **Athena** | Resistance | 5 min | I | 30 |
119+
| **Hermes** | Speed | 5 min | II | 20 |
120+
| **Apollo** | Regeneration | 3 min | I | 35 |
121+
| **Hephaestus** | Haste | 5 min | II | 15 |
122+
123+
### Tips:
124+
- Hover over god names in `/f gods` to see details, click to auto-fill the command
125+
- Check active blessings in `/f info`
126+
- **5 minute cooldown** between prayers - coordinate with your faction!
127+
- Blessings persist through death - you'll get them back when you respawn
128+
- If your faction is a **vassal**, your overlord's blessings may also apply to you
129+
130+
---
131+
132+
## 📊 Power Breakdown
133+
134+
Your faction's total power comes from multiple sources. Hover over "Total Power" in `/f info` to see:
135+
136+
| Source | Description |
137+
|--------|-------------|
138+
| **Base** | Starting power for all factions |
139+
| **Player** | Combined power from all active members |
140+
| **Wealth** | Power from sacrificing items |
141+
| **War** | Power from killing enemy players |
142+
| **Fame** | Power from completing dungeons and events |
143+
| **Vassal** | Bonus power from your vassals (if overlord) |
144+
| **Admin** | Power added/removed by server admins |

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ yarn_mappings=1.20.1+build.10
66
loader_version=0.14.22
77

88
# Mod Properties
9-
mod_version = 2.9.1.1
9+
mod_version = 3.0.0
1010
maven_group = io.icker
1111
archives_base_name = factions
1212

src/main/java/io/icker/factions/FactionsMod.java

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
package io.icker.factions;
22

3+
import java.util.UUID;
34
import org.apache.logging.log4j.LogManager;
45
import org.apache.logging.log4j.Logger;
56
import com.mojang.brigadier.CommandDispatcher;
67
import com.mojang.brigadier.tree.LiteralCommandNode;
8+
import io.icker.factions.api.persistents.Faction;
9+
import io.icker.factions.api.persistents.User;
710
import io.icker.factions.command.AdminCommand;
811
import io.icker.factions.command.ClaimCommand;
912
import io.icker.factions.command.CompatCommand;
1013
import io.icker.factions.command.CreateCommand;
1114
import io.icker.factions.command.DeclareCommand;
1215
import io.icker.factions.command.DisbandCommand;
16+
import io.icker.factions.command.GodsCommand;
1317
import io.icker.factions.command.HomeCommand;
1418
import io.icker.factions.command.InfoCommand;
1519
import io.icker.factions.command.InviteCommand;
@@ -23,7 +27,9 @@
2327
import io.icker.factions.command.PermissionCommand;
2428
import io.icker.factions.command.RankCommand;
2529
import io.icker.factions.command.SafeCommand;
30+
import io.icker.factions.command.SacrificeCommand;
2631
import io.icker.factions.command.SettingsCommand;
32+
import io.icker.factions.command.VassalCommand;
2733
import io.icker.factions.config.Config;
2834
import io.icker.factions.core.ChatManager;
2935
import io.icker.factions.core.FactionsManager;
@@ -89,14 +95,32 @@ private static void registerCommands(CommandDispatcher<ServerCommandSource> disp
8995

9096
Command[] commands = new Command[] {new AdminCommand(), new SettingsCommand(),
9197
new ClaimCommand(), new CompatCommand(), new CreateCommand(), new DeclareCommand(), new DisbandCommand(),
92-
new HomeCommand(), new InfoCommand(), new InviteCommand(), new JoinCommand(),
98+
new GodsCommand(), new HomeCommand(), new InfoCommand(), new InviteCommand(), new JoinCommand(),
9399
new KickCommand(), new LeaveCommand(), new ListCommand(), new MapCommand(),
94100
new MemberCommand(), new ModifyCommand(), new RankCommand(), new SafeCommand(),
95-
new PermissionCommand()};
101+
new SacrificeCommand(), new PermissionCommand(), new VassalCommand()};
96102

97103
for (Command command : commands) {
98104
factions.addChild(command.getNode());
99105
alias.addChild(command.getNode());
100106
}
101107
}
108+
109+
/**
110+
* Public API: Add fame power to a player's faction.
111+
* Use this method from other mods (e.g., dungeon mods) to grant fame.
112+
*
113+
* @param playerUUID The UUID of the player who earned the fame
114+
* @param amount The amount of fame power to add
115+
* @return The actual amount added (may be less if at max), or 0 if player has no faction
116+
*/
117+
public static int addFamePower(UUID playerUUID, int amount) {
118+
User user = User.get(playerUUID);
119+
if (user == null || !user.isInFaction()) {
120+
return 0;
121+
}
122+
123+
Faction faction = user.getFaction();
124+
return faction.addFamePower(amount);
125+
}
102126
}

src/main/java/io/icker/factions/api/persistents/Claim.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,16 @@ public class Claim {
3232
@Field("AccessLevel")
3333
public Rank accessLevel;
3434

35+
@Field("ClaimedAt")
36+
public long claimedAt;
37+
3538
public Claim(int x, int z, String level, UUID factionID) {
3639
this.x = x;
3740
this.z = z;
3841
this.level = level;
3942
this.factionID = factionID;
4043
this.accessLevel = Rank.MEMBER;
44+
this.claimedAt = System.currentTimeMillis();
4145
}
4246

4347
public Claim() {}

0 commit comments

Comments
 (0)