Make use of ignoreCancelled = true
This commit is contained in:
parent
2b11bc1042
commit
9e6904b564
@ -92,11 +92,9 @@ public class FactionsEntityListener implements Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onEntityDamage(EntityDamageEvent event)
|
public void onEntityDamage(EntityDamageEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
|
||||||
|
|
||||||
if (event instanceof EntityDamageByEntityEvent)
|
if (event instanceof EntityDamageByEntityEvent)
|
||||||
{
|
{
|
||||||
EntityDamageByEntityEvent sub = (EntityDamageByEntityEvent)event;
|
EntityDamageByEntityEvent sub = (EntityDamageByEntityEvent)event;
|
||||||
@ -173,11 +171,9 @@ public class FactionsEntityListener implements Listener
|
|||||||
PotionEffectType.WITHER
|
PotionEffectType.WITHER
|
||||||
));
|
));
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onPotionSplashEvent(PotionSplashEvent event)
|
public void onPotionSplashEvent(PotionSplashEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
|
||||||
|
|
||||||
// see if the potion has a harmful effect
|
// see if the potion has a harmful effect
|
||||||
boolean badjuju = false;
|
boolean badjuju = false;
|
||||||
for (PotionEffect effect : event.getPotion().getEffects())
|
for (PotionEffect effect : event.getPotion().getEffects())
|
||||||
@ -337,10 +333,9 @@ public class FactionsEntityListener implements Listener
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onCreatureSpawn(CreatureSpawnEvent event)
|
public void onCreatureSpawn(CreatureSpawnEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
|
||||||
if (event.getLocation() == null) return;
|
if (event.getLocation() == null) return;
|
||||||
|
|
||||||
PS ps = PS.valueOf(event.getLocation());
|
PS ps = PS.valueOf(event.getLocation());
|
||||||
@ -352,11 +347,9 @@ public class FactionsEntityListener implements Listener
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onEntityTarget(EntityTargetEvent event)
|
public void onEntityTarget(EntityTargetEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
|
||||||
|
|
||||||
// if there is a target
|
// if there is a target
|
||||||
Entity target = event.getTarget();
|
Entity target = event.getTarget();
|
||||||
if (target == null) return;
|
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)
|
public void onEntityChangeBlock(EntityChangeBlockEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
|
|
||||||
// for now, only interested in Enderman and Wither boss tomfoolery
|
// for now, only interested in Enderman and Wither boss tomfoolery
|
||||||
|
@ -129,10 +129,9 @@ public class FactionsPlayerListener implements Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onPlayerInteract(PlayerInteractEvent event)
|
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
|
// 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;
|
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),
|
// 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
|
// 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)
|
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
|
||||||
|
|
||||||
Block block = event.getBlockClicked();
|
Block block = event.getBlockClicked();
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
@ -241,11 +238,9 @@ public class FactionsPlayerListener implements Listener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onPlayerBucketFill(PlayerBucketFillEvent event)
|
public void onPlayerBucketFill(PlayerBucketFillEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
|
||||||
|
|
||||||
Block block = event.getBlockClicked();
|
Block block = event.getBlockClicked();
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
@ -315,11 +310,9 @@ public class FactionsPlayerListener implements Listener
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onPlayerKick(PlayerKickEvent event)
|
public void onPlayerKick(PlayerKickEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
|
||||||
|
|
||||||
FPlayer badGuy = FPlayerColl.get().get(event.getPlayer());
|
FPlayer badGuy = FPlayerColl.get().get(event.getPlayer());
|
||||||
if (badGuy == null)
|
if (badGuy == null)
|
||||||
{
|
{
|
||||||
@ -342,11 +335,9 @@ public class FactionsPlayerListener implements Listener
|
|||||||
// VisualizeUtil
|
// VisualizeUtil
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerMoveClearVisualizations(PlayerMoveEvent event)
|
public void onPlayerMoveClearVisualizations(PlayerMoveEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
|
||||||
|
|
||||||
Block blockFrom = event.getFrom().getBlock();
|
Block blockFrom = event.getFrom().getBlock();
|
||||||
Block blockTo = event.getTo().getBlock();
|
Block blockTo = event.getTo().getBlock();
|
||||||
if (blockFrom.equals(blockTo)) return;
|
if (blockFrom.equals(blockTo)) return;
|
||||||
|
Loading…
Reference in New Issue
Block a user