Don't even bother running these checks if we don't watch the block.

This commit is contained in:
GJ 2013-04-04 08:05:48 -04:00
parent 6772f4f169
commit a272316301

View File

@ -129,6 +129,12 @@ public class BlockListener implements Listener {
return; return;
} }
BlockState blockState = event.getBlock().getState();
if (!BlockUtils.shouldBeWatched(blockState)) {
return;
}
Player player = event.getPlayer(); Player player = event.getPlayer();
if (Misc.isNPCEntity(player) || player.getGameMode() == GameMode.CREATIVE) { if (Misc.isNPCEntity(player) || player.getGameMode() == GameMode.CREATIVE) {
@ -136,7 +142,6 @@ public class BlockListener implements Listener {
} }
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
BlockState blockState = event.getBlock().getState();
ItemStack heldItem = player.getItemInHand(); ItemStack heldItem = player.getItemInHand();
/* HERBALISM */ /* HERBALISM */
@ -186,7 +191,7 @@ public class BlockListener implements Listener {
} }
/* Remove metadata from placed watched blocks */ /* Remove metadata from placed watched blocks */
if (BlockUtils.shouldBeWatched(blockState) && mcMMO.placeStore.isTrue(blockState)) { if (mcMMO.placeStore.isTrue(blockState)) {
mcMMO.placeStore.setFalse(blockState); mcMMO.placeStore.setFalse(blockState);
} }
} }