Browse Source

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

GJ 12 years ago
parent
commit
a272316301
1 changed files with 7 additions and 2 deletions
  1. 7 2
      src/main/java/com/gmail/nossr50/listeners/BlockListener.java

+ 7 - 2
src/main/java/com/gmail/nossr50/listeners/BlockListener.java

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