Fix WG
This commit is contained in:
parent
14afabd37d
commit
c891bdf3ad
@ -82,7 +82,7 @@ public class WorldListener implements Listener {
|
||||
List<Block> toBreak = checker.getBrokenBlocksObjects();
|
||||
|
||||
if (isMovable) {
|
||||
if(!isBlocksAllowedToInteract(copyWithAdd(blocks,toBreak))) continue;
|
||||
if(!isBlocksAllowedToInteract(copyWithAdd(blocks,toBreak),piston.getFacing())) continue;
|
||||
for (Block block1 : toBreak) {
|
||||
block1.breakNaturally();
|
||||
}
|
||||
@ -193,7 +193,7 @@ public class WorldListener implements Listener {
|
||||
}
|
||||
|
||||
if (isMovable) {
|
||||
if(!isBlocksAllowedToInteract(copyWithAdd(blocks,toBreak))) return;
|
||||
if(!isBlocksAllowedToInteract(copyWithAdd(blocks,toBreak),piston.getFacing())) return;
|
||||
Collections.reverse(blocks);
|
||||
for (Block block1 : toBreak) {
|
||||
block1.breakNaturally();
|
||||
@ -264,7 +264,7 @@ public class WorldListener implements Listener {
|
||||
List<Block> toBreak = checker.getBrokenBlocksObjects();
|
||||
|
||||
if (isMovable) {
|
||||
if(!isBlocksAllowedToInteract(copyWithAdd(blocks,toBreak))) continue;
|
||||
if(!isBlocksAllowedToInteract(copyWithAdd(blocks,toBreak),piston.getFacing())) continue;
|
||||
for (Block block1 : toBreak) {
|
||||
block1.breakNaturally();
|
||||
}
|
||||
@ -362,7 +362,7 @@ public class WorldListener implements Listener {
|
||||
}
|
||||
|
||||
if (isMovable) {
|
||||
if(!isBlocksAllowedToInteract(copyWithAdd(blocks,toBreak))) return;
|
||||
if(!isBlocksAllowedToInteract(copyWithAdd(blocks,toBreak),piston.getFacing())) return;
|
||||
Collections.reverse(blocks);
|
||||
for (Block block1 : toBreak) {
|
||||
block1.breakNaturally();
|
||||
@ -403,7 +403,7 @@ public class WorldListener implements Listener {
|
||||
return 12;
|
||||
}
|
||||
|
||||
public boolean isBlocksAllowedToInteract(List<Block> blocks) {
|
||||
public boolean isBlocksAllowedToInteract(List<Block> blocks, BlockFace bf) {
|
||||
WorldGuardPlugin wg = ExtendedPistons.INSTANCE.wg;
|
||||
RegionContainer container = wg.getRegionContainer();
|
||||
RegionQuery query = container.createQuery();
|
||||
@ -411,6 +411,9 @@ public class WorldListener implements Listener {
|
||||
boolean state = query.testState(block.getLocation(),(Player)null, DefaultFlag.PISTONS);
|
||||
if(!state)
|
||||
return false;
|
||||
state = query.testState(block.getRelative(bf).getLocation(),(Player)null, DefaultFlag.PISTONS);
|
||||
if(!state)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user