mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-26 19:18:29 +01:00
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:
parent
465041b98b
commit
d1c014fe16
@ -271,23 +271,33 @@ public class SignBlockListener implements Listener
|
|||||||
|
|
||||||
if (event.isSticky())
|
if (event.isSticky())
|
||||||
{
|
{
|
||||||
final Block block = event.getBlock();
|
final Block pistonBaseBlock = event.getBlock();
|
||||||
if (((block.getType() == WALL_SIGN
|
final Block[] affectedBlocks = new Block[]
|
||||||
|| block.getType() == SIGN_POST)
|
{
|
||||||
&& EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block)))
|
pistonBaseBlock,
|
||||||
|| EssentialsSign.checkIfBlockBreaksSigns(block))
|
pistonBaseBlock.getRelative(event.getDirection()),
|
||||||
|
event.getRetractLocation().getBlock()
|
||||||
|
};
|
||||||
|
|
||||||
|
for (Block block : affectedBlocks)
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
if (((block.getType() == WALL_SIGN
|
||||||
return;
|
|| block.getType() == SIGN_POST)
|
||||||
}
|
&& EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block)))
|
||||||
for (EssentialsSign sign : ess.getSettings().enabledSigns())
|
|| EssentialsSign.checkIfBlockBreaksSigns(block))
|
||||||
{
|
|
||||||
if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType())
|
|
||||||
&& !sign.onBlockPush(block, ess))
|
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
for (EssentialsSign sign : ess.getSettings().enabledSigns())
|
||||||
|
{
|
||||||
|
if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType())
|
||||||
|
&& !sign.onBlockPush(block, ess))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user