Sfoglia il codice sorgente

Merge pull request #252 from mcunha/master

Fix ore dupe bug with ore blocks on pistons
nossr50 12 anni fa
parent
commit
e29484e14b

+ 5 - 1
src/main/java/com/gmail/nossr50/listeners/BlockListener.java

@@ -58,11 +58,15 @@ public class BlockListener implements Listener {
     public void onBlockPistonExtend(BlockPistonExtendEvent event) {
     public void onBlockPistonExtend(BlockPistonExtendEvent event) {
         List<Block> blocks = event.getBlocks();
         List<Block> blocks = event.getBlocks();
         BlockFace direction = event.getDirection();
         BlockFace direction = event.getDirection();
+        // Block that would be air after piston is finished
+        Block futureEmptyBlock = event.getBlock().getRelative(direction);
 
 
         for (Block b : blocks) {
         for (Block b : blocks) {
             if (mcMMO.placeStore.isTrue(b)) {
             if (mcMMO.placeStore.isTrue(b)) {
                 b.getRelative(direction).setMetadata("pistonTrack", new FixedMetadataValue(plugin, true));
                 b.getRelative(direction).setMetadata("pistonTrack", new FixedMetadataValue(plugin, true));
-                mcMMO.placeStore.setFalse(b);
+                if (b.equals(futureEmptyBlock)) {
+                    mcMMO.placeStore.setFalse(b);
+                }
             }
             }
         }
         }