summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidShakal <SidShakal@users.noreply.github.com>2014-07-19 09:37:37 -0500
committerKHobbits <rob@khobbits.co.uk>2014-07-19 20:08:38 +0100
commit52dacc054b1efb99c94afd81ec5a98573beaae13 (patch)
treeff8c78710cbcdbbad8b0c6e10a3795174092b68a
parent035182fcda8acf77d3727ce21993e9bb57c90077 (diff)
downloadEssentials-52dacc054b1efb99c94afd81ec5a98573beaae13.tar
Essentials-52dacc054b1efb99c94afd81ec5a98573beaae13.tar.gz
Essentials-52dacc054b1efb99c94afd81ec5a98573beaae13.tar.lz
Essentials-52dacc054b1efb99c94afd81ec5a98573beaae13.tar.xz
Essentials-52dacc054b1efb99c94afd81ec5a98573beaae13.zip
Fix sticky piston retract breaking essentials sign
Sticky pistons could break signs that were mounted on blocks the pistons were retracting. This patch extends the protection from just the piston base to include the extended piston arm and the block at the end of the piston arm as well. This method will very likely need to be changed again when 1.8 comes out, but this should bring us a bit closer, by wrapping the block tests in a loop.
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java34
1 files changed, 22 insertions, 12 deletions
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java b/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java
index e42b13d27..e59245596 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java
@@ -271,23 +271,33 @@ public class SignBlockListener implements Listener
if (event.isSticky())
{
- final Block block = event.getBlock();
- if (((block.getType() == WALL_SIGN
- || block.getType() == SIGN_POST)
- && EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block)))
- || EssentialsSign.checkIfBlockBreaksSigns(block))
- {
- event.setCancelled(true);
- return;
- }
- for (EssentialsSign sign : ess.getSettings().enabledSigns())
+ final Block pistonBaseBlock = event.getBlock();
+ final Block[] affectedBlocks = new Block[]
+ {
+ pistonBaseBlock,
+ pistonBaseBlock.getRelative(event.getDirection()),
+ event.getRetractLocation().getBlock()
+ };
+
+ for (Block block : affectedBlocks)
{
- if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType())
- && !sign.onBlockPush(block, ess))
+ if (((block.getType() == WALL_SIGN
+ || block.getType() == SIGN_POST)
+ && EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block)))
+ || EssentialsSign.checkIfBlockBreaksSigns(block))
{
event.setCancelled(true);
return;
}
+ for (EssentialsSign sign : ess.getSettings().enabledSigns())
+ {
+ if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType())
+ && !sign.onBlockPush(block, ess))
+ {
+ event.setCancelled(true);
+ return;
+ }
+ }
}
}
}