Check projectile shooter's type before casting. Fixes #158

This commit is contained in:
eueln 2014-12-07 13:20:48 -06:00
parent 5e676bdd50
commit e9b0a4d67c

View File

@ -260,7 +260,13 @@ public class FactionsEntityListener implements Listener {
// for damage caused by projectiles, getDamager() returns the projectile... what we need to know is the source // for damage caused by projectiles, getDamager() returns the projectile... what we need to know is the source
if (damager instanceof Projectile) { if (damager instanceof Projectile) {
damager = (Entity) ((Projectile) damager).getShooter(); Projectile projectile = (Projectile) damager;
if (!(projectile.getShooter() instanceof Entity)) {
return true;
}
damager = (Entity) projectile.getShooter();
} }
if (damager == damagee) // ender pearl usage and other self-inflicted damage if (damager == damagee) // ender pearl usage and other self-inflicted damage