mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-27 20:59:16 +01:00
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
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user