mirror of
https://github.com/PikaMug/Quests.git
synced 2024-12-19 15:48:10 +01:00
Ensure projectile source exists, fixes #369
This commit is contained in:
parent
1d04d263d7
commit
1bac3ed1f3
@ -58,7 +58,6 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
|||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
import org.bukkit.event.player.PlayerShearEntityEvent;
|
import org.bukkit.event.player.PlayerShearEntityEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.projectiles.ProjectileSource;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||||
@ -465,10 +464,9 @@ public class PlayerListener implements Listener {
|
|||||||
if (damager != null) {
|
if (damager != null) {
|
||||||
if (damager instanceof Projectile) {
|
if (damager instanceof Projectile) {
|
||||||
Projectile projectile = (Projectile) damager;
|
Projectile projectile = (Projectile) damager;
|
||||||
ProjectileSource source = projectile.getShooter();
|
if (projectile.getShooter() != null && projectile.getShooter() instanceof Entity) {
|
||||||
if (source instanceof Entity) {
|
killMob((Entity)projectile.getShooter(), evt.getEntity());
|
||||||
killMob((Entity)source, evt.getEntity());
|
}
|
||||||
}
|
|
||||||
} else if (damager instanceof TNTPrimed) {
|
} else if (damager instanceof TNTPrimed) {
|
||||||
TNTPrimed tnt = (TNTPrimed) damager;
|
TNTPrimed tnt = (TNTPrimed) damager;
|
||||||
Entity source = tnt.getSource();
|
Entity source = tnt.getSource();
|
||||||
@ -535,9 +533,8 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (damager instanceof Projectile) {
|
if (damager instanceof Projectile) {
|
||||||
Projectile projectile = (Projectile) damager;
|
Projectile projectile = (Projectile) damager;
|
||||||
ProjectileSource source = projectile.getShooter();
|
if (projectile.getShooter() != null && projectile.getShooter() instanceof Entity) {
|
||||||
if (source instanceof Entity) {
|
killPlayer((Entity)projectile.getShooter(), evt.getEntity());
|
||||||
killPlayer((Entity)source, evt.getEntity());
|
|
||||||
}
|
}
|
||||||
} else if (damager instanceof TNTPrimed) {
|
} else if (damager instanceof TNTPrimed) {
|
||||||
TNTPrimed tnt = (TNTPrimed) damager;
|
TNTPrimed tnt = (TNTPrimed) damager;
|
||||||
|
Loading…
Reference in New Issue
Block a user