Make use of ignoreCancelled = true

This commit is contained in:
Olof Larsson 2013-04-18 11:09:31 +02:00
parent 2b11bc1042
commit 9e6904b564
2 changed files with 10 additions and 28 deletions

View File

@ -92,11 +92,9 @@ public class FactionsEntityListener implements Listener
}
}
@EventHandler(priority = EventPriority.NORMAL)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityDamage(EntityDamageEvent event)
{
if (event.isCancelled()) return;
if (event instanceof EntityDamageByEntityEvent)
{
EntityDamageByEntityEvent sub = (EntityDamageByEntityEvent)event;
@ -173,11 +171,9 @@ public class FactionsEntityListener implements Listener
PotionEffectType.WITHER
));
@EventHandler(priority = EventPriority.NORMAL)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPotionSplashEvent(PotionSplashEvent event)
{
if (event.isCancelled()) return;
// see if the potion has a harmful effect
boolean badjuju = false;
for (PotionEffect effect : event.getPotion().getEffects())
@ -337,10 +333,9 @@ public class FactionsEntityListener implements Listener
return true;
}
@EventHandler(priority = EventPriority.NORMAL)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onCreatureSpawn(CreatureSpawnEvent event)
{
if (event.isCancelled()) return;
if (event.getLocation() == null) return;
PS ps = PS.valueOf(event.getLocation());
@ -352,11 +347,9 @@ public class FactionsEntityListener implements Listener
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.NORMAL)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityTarget(EntityTargetEvent event)
{
if (event.isCancelled()) return;
// if there is a target
Entity target = event.getTarget();
if (target == null) return;
@ -382,11 +375,9 @@ public class FactionsEntityListener implements Listener
@EventHandler(priority = EventPriority.NORMAL)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityChangeBlock(EntityChangeBlockEvent event)
{
if (event.isCancelled()) return;
Entity entity = event.getEntity();
// for now, only interested in Enderman and Wither boss tomfoolery

View File

@ -129,10 +129,9 @@ public class FactionsPlayerListener implements Listener
}
}
@EventHandler(priority = EventPriority.NORMAL)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent event)
{
if (event.isCancelled()) return;
// only need to check right-clicks and physical as of MC 1.4+; good performance boost
if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.PHYSICAL) return;
@ -227,11 +226,9 @@ public class FactionsPlayerListener implements Listener
// For some reason onPlayerInteract() sometimes misses bucket events depending on distance (something like 2-3 blocks away isn't detected),
// but these separate bucket events below always fire without fail
@EventHandler(priority = EventPriority.NORMAL)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event)
{
if (event.isCancelled()) return;
Block block = event.getBlockClicked();
Player player = event.getPlayer();
@ -241,11 +238,9 @@ public class FactionsPlayerListener implements Listener
return;
}
}
@EventHandler(priority = EventPriority.NORMAL)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerBucketFill(PlayerBucketFillEvent event)
{
if (event.isCancelled()) return;
Block block = event.getBlockClicked();
Player player = event.getPlayer();
@ -315,11 +310,9 @@ public class FactionsPlayerListener implements Listener
return false;
}
@EventHandler(priority = EventPriority.NORMAL)
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerKick(PlayerKickEvent event)
{
if (event.isCancelled()) return;
FPlayer badGuy = FPlayerColl.get().get(event.getPlayer());
if (badGuy == null)
{
@ -342,11 +335,9 @@ public class FactionsPlayerListener implements Listener
// VisualizeUtil
// -------------------------------------------- //
@EventHandler(priority = EventPriority.MONITOR)
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerMoveClearVisualizations(PlayerMoveEvent event)
{
if (event.isCancelled()) return;
Block blockFrom = event.getFrom().getBlock();
Block blockTo = event.getTo().getBlock();
if (blockFrom.equals(blockTo)) return;