mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Ignore Cancelled Events
Using new addition to Bukkit event system, should provide some speed increase.
This commit is contained in:
parent
6e59087f6d
commit
992e6bce86
@ -58,11 +58,9 @@ public class mcBlockListener implements Listener
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockPlace(BlockPlaceEvent event)
|
public void onBlockPlace(BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
if(event.isCancelled()) return;
|
|
||||||
|
|
||||||
//Setup some basic vars
|
//Setup some basic vars
|
||||||
Block block;
|
Block block;
|
||||||
Player player = event.getPlayer();
|
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)
|
public void onBlockBreak(BlockBreakEvent event)
|
||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
ItemStack inhand = player.getItemInHand();
|
ItemStack inhand = player.getItemInHand();
|
||||||
if(event.isCancelled())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (event instanceof FakeBlockBreakEvent)
|
if (event instanceof FakeBlockBreakEvent)
|
||||||
return;
|
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());
|
//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)
|
public void onBlockDamage(BlockDamageEvent event)
|
||||||
{
|
{
|
||||||
if(event.isCancelled())
|
|
||||||
return;
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
ItemStack inhand = player.getItemInHand();
|
ItemStack inhand = player.getItemInHand();
|
||||||
|
@ -57,12 +57,9 @@ public class mcEntityListener implements Listener
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onEntityDamage(EntityDamageEvent event)
|
public void onEntityDamage(EntityDamageEvent event)
|
||||||
{
|
{
|
||||||
if(event.isCancelled())
|
|
||||||
return;
|
|
||||||
|
|
||||||
//Check for world pvp flag
|
//Check for world pvp flag
|
||||||
if(event instanceof EntityDamageByEntityEvent)
|
if(event instanceof EntityDamageByEntityEvent)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user