@EventHandler(ignoreCancelled = true) public static void onBlockPistonRetract(BlockPistonRetractEvent event) { for (Block block : getRetractBlocks(event)) { if (!canBlockBeBroken(block, null)) { event.setCancelled(true); return; } } }
@EventHandler public void onPistonRetract(BlockPistonRetractEvent e) { if (e.isSticky()) { for (Block b : e.getBlocks()) { if (BlockStorage.hasBlockInfo(b)) { e.setCancelled(true); return; } else if(b.getRelative(e.getDirection()) == null && BlockStorage.hasBlockInfo(b.getRelative(e.getDirection()))) { e.setCancelled(true); return; } } } }
@EventHandler(ignoreCancelled = true) public void onPistonRetract(BlockPistonRetractEvent event) { String block = event.getBlock().getLocation().toString(); if (plugin.getGeneralKeeper().getSonicPistons().contains(block)) { event.setCancelled(true); plugin.getGeneralKeeper().getSonicListener().setExtension(event.getBlock()); } } }
@EventHandler(ignoreCancelled = true) public void onHarvestPistonRetract(BlockPistonRetractEvent event) { if (!event.isSticky()) { return; } if (plugin.getConfig().getBoolean("preferences.nerf_pistons.only_tardis_worlds") && !event.getBlock().getWorld().getName().contains("TARDIS")) { return; } String block = event.getBlock().getRelative(getOppositeDirection(event.getDirection()), 2).getLocation().toString(); if (plugin.getGeneralKeeper().getProtectBlockMap().containsKey(block)) { event.setCancelled(true); } }
.get(tempchunk + "" + pistonChunk.getX() + "," + pistonChunk.getZ() + "owner")) != null) { if (!owner1.equals(owner2)) { event.setCancelled(true); piston.getRelative(event.getDirection()).setType(Material.AIR); event.setCancelled(true); piston.getRelative(event.getDirection()).setType(Material.AIR);
event.setCancelled(true); PreciousStones.debug("Cancelling field sign move"); return; event.setCancelled(true); return; event.setCancelled(true); PreciousStones.debug("Cancelling unbreakable move"); return; event.setCancelled(true); PreciousStones.debug("Cancelling field conflict move"); return;
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void onBlockPistonRetract(BlockPistonRetractEvent event) { // if not a sticky piston, retraction should be fine if (!event.isSticky() || !Conf.pistonProtectionThroughDenyBuild) { return; } Location targetLoc = event.getRetractLocation(); Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(targetLoc)); // Check if the piston is moving in a faction's territory. This disables pistons entirely in faction territory. if (otherFaction.isNormal() && SavageFactions.plugin.getConfig().getBoolean("disable-pistons-in-territory", false)) { event.setCancelled(true); return; } // if potentially retracted block is just air/water/lava, no worries if (targetLoc.getBlock().isEmpty() || targetLoc.getBlock().isLiquid()) { return; } Faction pistonFaction = Board.getInstance().getFactionAt(new FLocation(event.getBlock())); if (!canPistonMoveBlock(pistonFaction, targetLoc)) { event.setCancelled(true); } }
if(pistonClaim == null && !event.getBlocks().isEmpty()) event.setCancelled(true); return; event.setCancelled(true); return; event.setCancelled(true); block.getWorld().createExplosion(block.getLocation(), 0); block.getWorld().dropItem(block.getLocation(), new ItemStack(Material.PISTON_STICKY_BASE));
@EventHandler(priority = EventPriority.HIGH) public void onPistonRetract(BlockPistonRetractEvent e) { for (Block b : e.getBlocks()) { Block newBlock = b.getRelative(e.getDirection()); Block belowNewBlock = newBlock.getRelative(BlockFace.DOWN); if (shopUtils.isShop(belowNewBlock.getLocation())) { e.setCancelled(true); for (Player p : Bukkit.getOnlinePlayers()) { Shop shop = shopUtils.getShop(belowNewBlock.getLocation()); if (shop.getItem() != null) { shop.getItem().resetForPlayer(p); } } } } }
Events.fireBulkEventToCancel(event, new BreakBlockEvent(event, cause, event.getBlock().getWorld(), blocks, Material.AIR)); if (originalSize != blocks.size()) { event.setCancelled(true);