Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Commit

Permalink
Handle entity attacks without attackers. Fixes #332.
Browse files Browse the repository at this point in the history
  • Loading branch information
oloflarsson committed Aug 7, 2013
1 parent 62dc8c6 commit 32e060c
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ public boolean canCombatDamageHappen(EntityDamageByEntityEvent event, boolean no
{
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);
Expand All @@ -291,6 +293,12 @@ public boolean canCombatDamageHappen(EntityDamageByEntityEvent event, boolean no
// ... 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)
Expand Down

0 comments on commit 32e060c

Please sign in to comment.