From 2c78bac8f7a6b69d9dbd323b816b38db8e7ced8b Mon Sep 17 00:00:00 2001 From: GJ Date: Fri, 18 Jan 2013 09:37:03 -0500 Subject: [PATCH] We only care about sand & gravel. Technically this was already addressed because no other blocks would have their place store set to true, but this eliminates unnecessary overhead caused by the checking of other falling blocks - anvils, dragon eggs, and TNT. --- .../nossr50/listeners/EntityListener.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 742567818..bf8c13ffe 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -56,19 +56,22 @@ public class EntityListener implements Listener { @EventHandler(priority = EventPriority.MONITOR) public void onEntityChangeBlockEvent(EntityChangeBlockEvent event) { Entity entity = event.getEntity(); - + if (entity instanceof FallingBlock) { int entityID = entity.getEntityId(); Block block = event.getBlock(); + Material type = block.getType(); - if (mcMMO.placeStore.isTrue(block)) { - plugin.addToFallingBlockTracker(entityID, block); - } + if (type == Material.SAND || type == Material.GRAVEL) { + if (mcMMO.placeStore.isTrue(block)) { + plugin.addToFallingBlockTracker(entityID, block); + } - if (plugin.fallingBlockIsTracked(entityID) && block.getType() == Material.AIR) { - mcMMO.placeStore.setFalse(plugin.getSourceBlock(entityID)); - mcMMO.placeStore.setTrue(block); - plugin.removeFromFallingBlockTracker(entityID); + if (plugin.fallingBlockIsTracked(entityID) && block.getType() == Material.AIR) { + mcMMO.placeStore.setFalse(plugin.getSourceBlock(entityID)); + mcMMO.placeStore.setTrue(block); + plugin.removeFromFallingBlockTracker(entityID); + } } } }