From eceb10c185150f60634d5959f0a149ca9b596cdd Mon Sep 17 00:00:00 2001 From: Ihaveaporpoise Date: Tue, 30 Sep 2014 17:20:06 -0500 Subject: [PATCH] Prevent players in peaceful factions from damaging with harmful potions. Fixes issue #50. --- .../factions/listeners/FactionsEntityListener.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java index 6774fd1d..843a57de 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -205,6 +205,15 @@ public class FactionsEntityListener implements Listener { return; } + if(thrower instanceof Player){ + Player player = (Player) thrower; + FPlayer fPlayer = FPlayers.i.get(player); + if(badjuju && fPlayer.getFaction().isPeaceful()){ + event.setCancelled(true); + return; + } + } + // scan through affected entities to make sure they're all valid targets Iterator iter = event.getAffectedEntities().iterator(); while (iter.hasNext()) {