Check projectile shooter's type before casting. Fixes #158
This commit is contained in:
parent
5e676bdd50
commit
e9b0a4d67c
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user