From bc56ff6651546982184cf6ab3f2c962c5880283a Mon Sep 17 00:00:00 2001 From: Brettflan Date: Sun, 24 Jul 2011 06:10:48 -0500 Subject: [PATCH] new conf.json option "powerFactionMax" (default 0) for maximum power limit for all factions. If set to anything above 0, factions will have their power capped at this amount. As a result, any players adding power beyond the faction's limit will effectively just be adding a buffer of sorts. (feature added thanks to donation from Magesblood) --- src/com/massivecraft/factions/Conf.java | 1 + src/com/massivecraft/factions/Faction.java | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/com/massivecraft/factions/Conf.java b/src/com/massivecraft/factions/Conf.java index 873e9b9b..13c8f39a 100644 --- a/src/com/massivecraft/factions/Conf.java +++ b/src/com/massivecraft/factions/Conf.java @@ -28,6 +28,7 @@ public class Conf { public static double powerPerMinute = 0.2; // Default health rate... it takes 5 min to heal one power public static double powerPerDeath = 4; // A death makes you lose 4 power public static boolean powerRegenOffline = false; // does player power regenerate even while they're offline? + public static double powerFactionMax = 0; // if greater than 0, the cap on how much power a faction can have (additional power from players beyond that will act as a "buffer" of sorts) public static String prefixAdmin = "**"; public static String prefixMod = "*"; diff --git a/src/com/massivecraft/factions/Faction.java b/src/com/massivecraft/factions/Faction.java index 61086e23..837487a5 100644 --- a/src/com/massivecraft/factions/Faction.java +++ b/src/com/massivecraft/factions/Faction.java @@ -203,6 +203,9 @@ public class Faction { for (FPlayer fplayer : this.getFPlayers()) { ret += fplayer.getPower(); } + if (Conf.powerFactionMax > 0 && ret > Conf.powerFactionMax) { + ret = Conf.powerFactionMax; + } return ret; } @@ -211,6 +214,9 @@ public class Faction { for (FPlayer fplayer : this.getFPlayers()) { ret += fplayer.getPowerMax(); } + if (Conf.powerFactionMax > 0 && ret > Conf.powerFactionMax) { + ret = Conf.powerFactionMax; + } return ret; }