From cbd0ee42ba5ee3475d2d905981eb7ad1eb1f5c3b Mon Sep 17 00:00:00 2001 From: Brettflan Date: Fri, 10 Jun 2011 07:38:14 -0500 Subject: [PATCH] New conf.json option "warZoneFriendlyFire", defaults to disabled; if enabled, allies and fellow faction members can hurt each other in war zones --- src/org/mcteam/factions/Conf.java | 1 + .../mcteam/factions/listeners/FactionsEntityListener.java | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/org/mcteam/factions/Conf.java b/src/org/mcteam/factions/Conf.java index 8f2884e1..ef1a69f6 100644 --- a/src/org/mcteam/factions/Conf.java +++ b/src/org/mcteam/factions/Conf.java @@ -80,6 +80,7 @@ public class Conf { public static boolean warZoneBlockFireballs = false; public static boolean warZoneBlockTNT = true; public static boolean warZonePowerLoss = true; + public static boolean warZoneFriendlyFire = false; public static boolean wildernessDenyBuild = false; public static boolean wildernessDenyUseage = false; diff --git a/src/org/mcteam/factions/listeners/FactionsEntityListener.java b/src/org/mcteam/factions/listeners/FactionsEntityListener.java index 7207e065..6fff82b6 100644 --- a/src/org/mcteam/factions/listeners/FactionsEntityListener.java +++ b/src/org/mcteam/factions/listeners/FactionsEntityListener.java @@ -156,11 +156,16 @@ public class FactionsEntityListener extends EntityListener { return true; } + Faction locFaction = Board.getFactionAt(new FLocation(attacker)); + // so we know from above that the defender isn't in a safezone... what about the attacker, sneaky dog that he might be? - if (Board.getFactionAt(new FLocation(attacker)).isSafeZone()) { + if (locFaction.isSafeZone()) { attacker.sendMessage("You can't hurt other players while you are in a SafeZone."); return false; } + else if (locFaction.isWarZone() && Conf.warZoneFriendlyFire) { + return true; + } Relation relation = defender.getRelation(attacker);