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.
This commit is contained in:
SidShakal 2014-07-19 09:37:37 -05:00 committed by KHobbits
parent 465041b98b
commit d1c014fe16

View File

@ -271,7 +271,16 @@ public class SignBlockListener implements Listener
if (event.isSticky()) if (event.isSticky())
{ {
final Block block = event.getBlock(); final Block pistonBaseBlock = event.getBlock();
final Block[] affectedBlocks = new Block[]
{
pistonBaseBlock,
pistonBaseBlock.getRelative(event.getDirection()),
event.getRetractLocation().getBlock()
};
for (Block block : affectedBlocks)
{
if (((block.getType() == WALL_SIGN if (((block.getType() == WALL_SIGN
|| block.getType() == SIGN_POST) || block.getType() == SIGN_POST)
&& EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block))) && EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block)))
@ -292,3 +301,4 @@ public class SignBlockListener implements Listener
} }
} }
} }
}