From f7e0b73465b8ab4d0ba314e4ae3bbde0e649efbf Mon Sep 17 00:00:00 2001 From: taoneill Date: Tue, 20 Dec 2011 02:34:39 -0500 Subject: [PATCH] Now checking if War is laoded in entity_death. --- .../tommytony/war/WarEntityListener.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/war/src/main/java/bukkit/tommytony/war/WarEntityListener.java b/war/src/main/java/bukkit/tommytony/war/WarEntityListener.java index 3424a04..a1f246c 100644 --- a/war/src/main/java/bukkit/tommytony/war/WarEntityListener.java +++ b/war/src/main/java/bukkit/tommytony/war/WarEntityListener.java @@ -440,16 +440,18 @@ public class WarEntityListener extends EntityListener { @Override public void onEntityDeath(EntityDeathEvent event) { - if (event.getEntity() instanceof Player) { - Player player = (Player) event.getEntity(); - Warzone zone = Warzone.getZoneByPlayerName(player.getName()); - if (zone != null) { - event.getDrops().clear(); - zone.handleDeath(player); - - for (Team team : zone.getTeams()) { - team.teamcast(player.getName() + " died"); - } + if (!War.war.isLoaded() || !(event.getEntity() instanceof Player)) { + return; + } + + Player player = (Player) event.getEntity(); + Warzone zone = Warzone.getZoneByPlayerName(player.getName()); + if (zone != null) { + event.getDrops().clear(); + zone.handleDeath(player); + + for (Team team : zone.getTeams()) { + team.teamcast(player.getName() + " died"); } } }