From 992e6bce865dd7cec43d35bc7f531ae4a3c1ae12 Mon Sep 17 00:00:00 2001 From: NuclearW Date: Wed, 15 Feb 2012 16:17:29 -0500 Subject: [PATCH] Ignore Cancelled Events Using new addition to Bukkit event system, should provide some speed increase. --- .../gmail/nossr50/listeners/mcBlockListener.java | 14 ++++---------- .../gmail/nossr50/listeners/mcEntityListener.java | 5 +---- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java index a95fce105..9fc1f111a 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java @@ -58,11 +58,9 @@ public class mcBlockListener implements Listener this.plugin = plugin; } - @EventHandler(priority = EventPriority.MONITOR) + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onBlockPlace(BlockPlaceEvent event) - { - if(event.isCancelled()) return; - + { //Setup some basic vars Block block; Player player = event.getPlayer(); @@ -137,15 +135,13 @@ public class mcBlockListener implements Listener } } - @EventHandler(priority = EventPriority.MONITOR) + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onBlockBreak(BlockBreakEvent event) { Player player = event.getPlayer(); PlayerProfile PP = Users.getProfile(player); Block block = event.getBlock(); ItemStack inhand = player.getItemInHand(); - if(event.isCancelled()) - return; if (event instanceof FakeBlockBreakEvent) return; @@ -291,11 +287,9 @@ public class mcBlockListener implements Listener //System.out.println("DEBUG: "+event.isCancelled()+", BLOCK_TYPE: "+event.getBlock().getType().toString()+", BLOCK_DATA: "+event.getBlock().getData()); } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockDamage(BlockDamageEvent event) { - if(event.isCancelled()) - return; Player player = event.getPlayer(); PlayerProfile PP = Users.getProfile(player); ItemStack inhand = player.getItemInHand(); diff --git a/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java b/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java index 901b54d6d..4415a64a2 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java @@ -57,12 +57,9 @@ public class mcEntityListener implements Listener this.plugin = plugin; } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onEntityDamage(EntityDamageEvent event) { - if(event.isCancelled()) - return; - //Check for world pvp flag if(event instanceof EntityDamageByEntityEvent) {