@EventHandler(priority = EventPriority.LOWEST)
public void onp(BreakBlockEvent e) {
Block block = e.getCause().getFirstBlock();
if (block != null && (block.getType() == Material.MOVING_PISTON || block.getType() == Material.PISTON
|| block.getType() == Material.STICKY_PISTON)) {
List<Block> blocks = e.getBlocks();
for (Block b : blocks) {
if (WGRegionUtils.isFlagAllows(null, b.getLocation(), PistonGrief.getInstance())) {
if (WGRegionUtils.isFlagAllows(null, b.getLocation(), Flags.PISTONS)) {
e.setResult(Result.ALLOW);
}
}
}
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void onp(PlaceBlockEvent e) {
Block block = e.getCause().getFirstBlock();
if (block != null && (block.getType() == Material.MOVING_PISTON || block.getType() == Material.PISTON
|| block.getType() == Material.STICKY_PISTON)) {
List<Block> blocks = e.getBlocks();
for (Block b : blocks) {
if (WGRegionUtils.isFlagAllows(null, b.getLocation(), PistonGrief.getInstance())) {
if (WGRegionUtils.isFlagAllows(null, b.getLocation(), Flags.PISTONS)) {
e.setResult(Result.ALLOW);
}
}
}
}
}