From 23d916f191b2e8bc1394c67c3ddaf1bacc9bf833 Mon Sep 17 00:00:00 2001 From: GJ Date: Sat, 26 May 2012 10:50:12 -0400 Subject: [PATCH] Fixed dupe exploit with pistons (again). --- Changelog.txt | 1 + .../java/com/gmail/nossr50/listeners/BlockListener.java | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index eb24d9d8f..a6b31646d 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -10,6 +10,7 @@ Key: Version 1.3.09 = Fixed issue with NoCheatPlus and Serrated Strikes / Skull Splitter (fight.noswing) = Fixed bug where you could receive Archery XP from Potions + = Fixed bug with duping blocks via piston pushing ! Changed Spout settings to be in their own config file (spout.yml) Version 1.3.08 diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 272938b80..9645cb1f1 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -36,6 +36,7 @@ import org.bukkit.event.block.BlockPistonExtendEvent; import org.bukkit.event.block.BlockPistonRetractEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.metadata.FixedMetadataValue; import org.getspout.spoutapi.sound.SoundEffect; @@ -58,15 +59,15 @@ public class BlockListener implements Listener { for (Block b : blocks) { if (mcMMO.placeStore.isTrue(b)) { - mcMMO.placeStore.setTrue(b.getRelative(direction)); + b.getRelative(direction).setMetadata("pistonTrack", new FixedMetadataValue(plugin, true)); mcMMO.placeStore.setFalse(b); } } for (Block b : blocks) { - if (mcMMO.placeStore.isTrue(b.getRelative(direction))) { + if (b.getRelative(direction).hasMetadata("pistonTrack")) { mcMMO.placeStore.setTrue(b.getRelative(direction)); - mcMMO.placeStore.setFalse(b); + b.getRelative(direction).removeMetadata("pistonTrack", plugin); } } }