Handle entity attacks without attackers. Fixes #332.
This commit is contained in:
parent
62dc8c6046
commit
32e060c2c3
@ -282,7 +282,9 @@ public class FactionsListenerMain implements Listener
|
|||||||
{
|
{
|
||||||
eattacker = ((Projectile)eattacker).getShooter();
|
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 ...
|
// ... gather defender PS and faction information ...
|
||||||
PS defenderPs = PS.valueOf(defender);
|
PS defenderPs = PS.valueOf(defender);
|
||||||
@ -291,6 +293,12 @@ public class FactionsListenerMain implements Listener
|
|||||||
// ... PVP flag may cause a damage block ...
|
// ... PVP flag may cause a damage block ...
|
||||||
if (defenderPsFaction.getFlag(FFlag.PVP) == false)
|
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 (eattacker instanceof Player)
|
||||||
{
|
{
|
||||||
if (notify)
|
if (notify)
|
||||||
|
Loading…
Reference in New Issue
Block a user