From c1e82b566e08c25ffd49e158460b54a586a10a09 Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Sun, 20 Jan 2013 18:06:30 -0800 Subject: [PATCH] Fixing a new duping bug. And this time it was NOT our fault! --- .../gmail/nossr50/listeners/BlockListener.java | 2 +- .../nossr50/runnables/StickyPistonTracker.java | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 6c97c6d6b..74d3c1727 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -87,7 +87,7 @@ public class BlockListener implements Listener { public void onBlockPistonRetract(BlockPistonRetractEvent event) { if (event.isSticky()) { //Needed only because under some circumstances Minecraft doesn't move the block - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new StickyPistonTracker(event), 0); + plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new StickyPistonTracker(event), 2); } } diff --git a/src/main/java/com/gmail/nossr50/runnables/StickyPistonTracker.java b/src/main/java/com/gmail/nossr50/runnables/StickyPistonTracker.java index bcf27ce2c..a7996d743 100644 --- a/src/main/java/com/gmail/nossr50/runnables/StickyPistonTracker.java +++ b/src/main/java/com/gmail/nossr50/runnables/StickyPistonTracker.java @@ -15,13 +15,16 @@ public class StickyPistonTracker implements Runnable { @Override public void run() { - Block originalBlock = event.getRetractLocation().getBlock(); + Block newBlock = event.getBlock().getRelative(event.getDirection()); + Block originalBlock = newBlock.getRelative(event.getDirection()); - if (originalBlock.getType() == Material.AIR && mcMMO.placeStore.isTrue(originalBlock)) { - Block newBlock = originalBlock.getRelative(event.getDirection().getOppositeFace()); + if (originalBlock.getType() != Material.AIR) + return; - mcMMO.placeStore.setFalse(originalBlock); - mcMMO.placeStore.setTrue(newBlock); - } + if (!mcMMO.placeStore.isTrue(originalBlock)) + return; + + mcMMO.placeStore.setFalse(originalBlock); + mcMMO.placeStore.setTrue(newBlock); } }