From 32e060c2c3ed14eb084bac8eaf16e88de7c01b89 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Wed, 7 Aug 2013 07:52:26 +0200 Subject: [PATCH] Handle entity attacks without attackers. Fixes #332. --- .../factions/listeners/FactionsListenerMain.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/com/massivecraft/factions/listeners/FactionsListenerMain.java b/src/com/massivecraft/factions/listeners/FactionsListenerMain.java index 24ee19ff..a5cc154e 100644 --- a/src/com/massivecraft/factions/listeners/FactionsListenerMain.java +++ b/src/com/massivecraft/factions/listeners/FactionsListenerMain.java @@ -282,7 +282,9 @@ public class FactionsListenerMain implements Listener { eattacker = ((Projectile)eattacker).getShooter(); } - if (eattacker.equals(edefender)) return true; + // (we check null here since there may not be an attacker) + // (lack of attacker situations can be caused by other bukkit plugins) + if (eattacker != null && eattacker.equals(edefender)) return true; // ... gather defender PS and faction information ... PS defenderPs = PS.valueOf(defender); @@ -291,6 +293,12 @@ public class FactionsListenerMain implements Listener // ... PVP flag may cause a damage block ... if (defenderPsFaction.getFlag(FFlag.PVP) == false) { + if (eattacker == null) + { + // No attacker? + // Let's behave as if it were a player + return false; + } if (eattacker instanceof Player) { if (notify)