Fix ProjectileSource -> Entity CCE; resolves #735

This commit is contained in:
Daniel Saukel 2020-04-11 13:45:22 +02:00
parent 70929fbda5
commit 42cd5a1bf2

View File

@ -64,6 +64,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.projectiles.ProjectileSource;
/** /**
* @author Daniel Saukel, Frank Baumann, Milan Albrecht * @author Daniel Saukel, Frank Baumann, Milan Albrecht
@ -159,7 +160,10 @@ public class DPlayerListener implements Listener {
Entity attackedEntity = event.getEntity(); Entity attackedEntity = event.getEntity();
if (attackerEntity instanceof Projectile) { if (attackerEntity instanceof Projectile) {
attackerEntity = (Entity) ((Projectile) attackerEntity).getShooter(); ProjectileSource source = ((Projectile) attackerEntity).getShooter();
if (source instanceof Entity) {
attackerEntity = (Entity) source;
}
} }
Player attackerPlayer = null; Player attackerPlayer = null;