diff --git a/war/src/main/java/bukkit/tommytony/war/War.java b/war/src/main/java/bukkit/tommytony/war/War.java index fbbf76e..53c93a6 100644 --- a/war/src/main/java/bukkit/tommytony/war/War.java +++ b/war/src/main/java/bukkit/tommytony/war/War.java @@ -143,7 +143,7 @@ public class War extends JavaPlugin { pm.registerEvent(Event.Type.ENTITY_EXPLODE, entityListener, Priority.Normal, this); //pm.registerEvent(Event.Type.ENTITY_DEATH, entityListener, Priority.Normal, this); - pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Priority.Normal, this); + pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Priority.High, this); pm.registerEvent(Event.Type.ENTITY_COMBUST, entityListener, Priority.Normal, this); pm.registerEvent(Event.Type.CREATURE_SPAWN, entityListener, Priority.Normal, this); pm.registerEvent(Event.Type.ENTITY_REGAIN_HEALTH, entityListener, Priority.Normal, this); @@ -1618,4 +1618,4 @@ public class War extends JavaPlugin { public boolean isLoaded() { return loaded; } -} \ No newline at end of file +} diff --git a/war/src/main/java/bukkit/tommytony/war/WarEntityListener.java b/war/src/main/java/bukkit/tommytony/war/WarEntityListener.java index db4269a..15e3c9c 100644 --- a/war/src/main/java/bukkit/tommytony/war/WarEntityListener.java +++ b/war/src/main/java/bukkit/tommytony/war/WarEntityListener.java @@ -165,12 +165,16 @@ public class WarEntityListener extends EntityListener { public void onEntityDamage(EntityDamageEvent event) { if(war.isLoaded()) { + Entity entity = event.getEntity(); + if(entity instanceof Player && war.getPlayerTeamWarzone(((Player) entity).getName()) != null) { + event.setCancelled(false); + } + if(event instanceof EntityDamageByEntityEvent || event instanceof EntityDamageByProjectileEvent) { handlerAttackDefend((EntityDamageByEntityEvent)event); } else { // Detect death (from , prevent it and respawn the player - Entity entity = event.getEntity(); if(entity instanceof Player) { Player player = (Player) entity; Warzone zone = war.getPlayerTeamWarzone(player.getName());