From 1bac3ed1f32aef47fbfd3166075f9aff4f4e602b Mon Sep 17 00:00:00 2001 From: HappyPikachu Date: Tue, 17 Apr 2018 11:17:10 -0400 Subject: [PATCH] Ensure projectile source exists, fixes #369 --- .../java/me/blackvein/quests/PlayerListener.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main/java/me/blackvein/quests/PlayerListener.java b/src/main/java/me/blackvein/quests/PlayerListener.java index 941393052..c5e529441 100644 --- a/src/main/java/me/blackvein/quests/PlayerListener.java +++ b/src/main/java/me/blackvein/quests/PlayerListener.java @@ -58,7 +58,6 @@ import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerShearEntityEvent; import org.bukkit.inventory.ItemStack; -import org.bukkit.projectiles.ProjectileSource; import org.bukkit.scheduler.BukkitRunnable; import com.sk89q.worldguard.protection.managers.RegionManager; @@ -465,10 +464,9 @@ public class PlayerListener implements Listener { if (damager != null) { if (damager instanceof Projectile) { Projectile projectile = (Projectile) damager; - ProjectileSource source = projectile.getShooter(); - if (source instanceof Entity) { - killMob((Entity)source, evt.getEntity()); - } + if (projectile.getShooter() != null && projectile.getShooter() instanceof Entity) { + killMob((Entity)projectile.getShooter(), evt.getEntity()); + } } else if (damager instanceof TNTPrimed) { TNTPrimed tnt = (TNTPrimed) damager; Entity source = tnt.getSource(); @@ -535,9 +533,8 @@ public class PlayerListener implements Listener { } if (damager instanceof Projectile) { Projectile projectile = (Projectile) damager; - ProjectileSource source = projectile.getShooter(); - if (source instanceof Entity) { - killPlayer((Entity)source, evt.getEntity()); + if (projectile.getShooter() != null && projectile.getShooter() instanceof Entity) { + killPlayer((Entity)projectile.getShooter(), evt.getEntity()); } } else if (damager instanceof TNTPrimed) { TNTPrimed tnt = (TNTPrimed) damager;