Skip to content

Commit d1c014f

Browse files
SidShakalkhobbits
authored andcommitted
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.
1 parent 465041b commit d1c014f

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -271,23 +271,33 @@ public void onSignBlockPistonRetract(final BlockPistonRetractEvent event)
271271

272272
if (event.isSticky())
273273
{
274-
final Block block = event.getBlock();
275-
if (((block.getType() == WALL_SIGN
276-
|| block.getType() == SIGN_POST)
277-
&& EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block)))
278-
|| EssentialsSign.checkIfBlockBreaksSigns(block))
279-
{
280-
event.setCancelled(true);
281-
return;
282-
}
283-
for (EssentialsSign sign : ess.getSettings().enabledSigns())
274+
final Block pistonBaseBlock = event.getBlock();
275+
final Block[] affectedBlocks = new Block[]
276+
{
277+
pistonBaseBlock,
278+
pistonBaseBlock.getRelative(event.getDirection()),
279+
event.getRetractLocation().getBlock()
280+
};
281+
282+
for (Block block : affectedBlocks)
284283
{
285-
if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType())
286-
&& !sign.onBlockPush(block, ess))
284+
if (((block.getType() == WALL_SIGN
285+
|| block.getType() == SIGN_POST)
286+
&& EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block)))
287+
|| EssentialsSign.checkIfBlockBreaksSigns(block))
287288
{
288289
event.setCancelled(true);
289290
return;
290291
}
292+
for (EssentialsSign sign : ess.getSettings().enabledSigns())
293+
{
294+
if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType())
295+
&& !sign.onBlockPush(block, ess))
296+
{
297+
event.setCancelled(true);
298+
return;
299+
}
300+
}
291301
}
292302
}
293303
}

0 commit comments

Comments
 (0)