diff --git a/src/com/massivecraft/factions/ConfServer.java b/src/com/massivecraft/factions/ConfServer.java index 164e8899..998005fc 100644 --- a/src/com/massivecraft/factions/ConfServer.java +++ b/src/com/massivecraft/factions/ConfServer.java @@ -197,9 +197,6 @@ public class ConfServer extends SimpleConfig public static double homesTeleportAllowedEnemyDistance = 32.0; public static boolean homesTeleportIgnoreEnemiesIfInOwnTerritory = true; - // TODO: This one should not be in the config should it? It should be built into the enum? - public static Rel friendlyFireFromRel = Rel.TRUCE; - public static boolean disablePVPForFactionlessPlayers = false; public static boolean enablePVPAgainstFactionlessInAttackersLand = false; diff --git a/src/com/massivecraft/factions/Rel.java b/src/com/massivecraft/factions/Rel.java index b9a03165..fa56e99b 100644 --- a/src/com/massivecraft/factions/Rel.java +++ b/src/com/massivecraft/factions/Rel.java @@ -9,14 +9,14 @@ public enum Rel // ENUM // -------------------------------------------- // - LEADER (70, "your faction leader", "your faction leader", "", ""), - OFFICER (60, "an officer in your faction", "officers in your faction", "", ""), - MEMBER (50, "a member in your faction", "members in your faction", "your faction", "your factions"), - RECRUIT (45, "a recruit in your faction", "recruits in your faction", "", ""), - ALLY (40, "an ally", "allies", "an allied faction", "allied factions"), - TRUCE (30, "someone in truce with you", "those in truce with you", "a faction in truce", "factions in truce"), - NEUTRAL (20, "someone neutral to you", "those neutral to you", "a neutral faction", "neutral factions"), - ENEMY (10, "an enemy", "enemies", "an enemy faction", "enemy factions"), + LEADER (70, true, "your faction leader", "your faction leader", "", ""), + OFFICER (60, true, "an officer in your faction", "officers in your faction", "", ""), + MEMBER (50, true, "a member in your faction", "members in your faction", "your faction", "your factions"), + RECRUIT (45, true, "a recruit in your faction", "recruits in your faction", "", ""), + ALLY (40, true, "an ally", "allies", "an allied faction", "allied factions"), + TRUCE (30, true, "someone in truce with you", "those in truce with you", "a faction in truce", "factions in truce"), + NEUTRAL (20, false, "someone neutral to you", "those neutral to you", "a neutral faction", "neutral factions"), + ENEMY (10, false, "an enemy", "enemies", "an enemy faction", "enemy factions"), // END OF LIST ; @@ -26,6 +26,11 @@ public enum Rel // -------------------------------------------- // private final int value; + + // Used for friendly fire. + private final boolean friend; + public boolean isFriend() { return this.friend; } + private final String descPlayerOne; public String getDescPlayerOne() { return this.descPlayerOne; } @@ -42,9 +47,10 @@ public enum Rel // CONSTRUCT // -------------------------------------------- // - private Rel(final int value, final String descPlayerOne, final String descPlayerMany, final String descFactionOne, final String descFactionMany) + private Rel(final int value, final boolean friend, final String descPlayerOne, final String descPlayerMany, final String descFactionOne, final String descFactionMany) { this.value = value; + this.friend = friend; this.descPlayerOne = descPlayerOne; this.descPlayerMany = descPlayerMany; this.descFactionOne = descFactionOne; diff --git a/src/com/massivecraft/factions/listeners/FactionsListenerMain.java b/src/com/massivecraft/factions/listeners/FactionsListenerMain.java index 6bb5d1f0..f94f0273 100644 --- a/src/com/massivecraft/factions/listeners/FactionsListenerMain.java +++ b/src/com/massivecraft/factions/listeners/FactionsListenerMain.java @@ -211,7 +211,7 @@ public class FactionsListenerMain implements Listener Rel relation = defendFaction.getRelationTo(attackFaction); // Check the relation - if (fdefender.hasFaction() && relation.isAtLeast(ConfServer.friendlyFireFromRel) && defenderPsFaction.getFlag(FFlag.FRIENDLYFIRE) == false) + if (fdefender.hasFaction() && relation.isFriend() && defenderPsFaction.getFlag(FFlag.FRIENDLYFIRE) == false) { if (notify) fattacker.msg("You can't hurt %s.", relation.getDescPlayerMany()); return false;