@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true) public void onBlockBreak(BlockBreakEvent evt) { Block b = evt.getBlock(); if(b == null) return; /* Work around for stupid mods.... */ Location l = b.getLocation(); core.listenerManager.processBlockEvent(EventType.BLOCK_BREAK, b.getType().getId(), getWorld(l.getWorld()).getName(), l.getBlockX(), l.getBlockY(), l.getBlockZ()); } }, DynmapPlugin.this);
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true) public void onBlockBreak(BlockBreakEvent event) { Block b = event.getBlock(); if(b == null) return; /* Stupid mod workaround */ Location loc = b.getLocation(); String wn = getWorld(loc.getWorld()).getName(); sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); mapManager.touch(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), "blockbreak"); } };
@Override public MCBlock getBlock() { return new BukkitMCBlock(event.getBlock()); }
/** * Prevents blocks that are protected from being broken, which would bypass the protection * * @param e - event */ @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBlockBreak(final BlockBreakEvent e) { checkClickedBlock(e, e.getBlock().getLocation(), e.getBlock().getType()); } }
public List<Location> customBlocks = new ArrayList<Location>(); //... in the block place event add the block's location to the list @EventHandler public void onBlockBreak(BlockBreakEvent broke){ Player player = broke.getPlayer(); PlayerInventory inventory = broke.getPlayer().getInventory(); World world = player.getWorld(); Material block = broke.getBlock().getType(); if(customBlocks.contains(block.getLocation())){ //custom block block.setType(Material.AIR); //destroy the block } }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onBlockBreak(BlockBreakEvent e) { Network.handleAllNetworkLocationUpdate(e.getBlock().getLocation()); } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
/** * Prevents blocks from being broken * * @param e - event */ @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBlockBreak(final BlockBreakEvent e) { checkIsland(e, e.getBlock().getLocation(), Flags.BREAK_BLOCKS); }
/** * Check if a sign was broken * * @param event */ @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @SuppressWarnings("ucd") public void onBlockBreak(BlockBreakEvent event) { removeSignIfNeeded(event.getBlock(), event.getPlayer()); }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onBlockBreak(BlockBreakEvent event) { blockChangeCheck(event.getBlock().getLocation()); }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void on(BlockBreakEvent event) { Location location = event.getBlock().getLocation(); removesSignAtLocation.remove(location) .ifPresent(sign -> messenger.tell( event.getPlayer(), "Removed " + sign.type + " sign for arena " + sign.arenaId )); }
@EventHandler public void onBreak(BlockBreakEvent evt) { if (shouldCancel(evt.getPlayer(), evt.getBlock())) { evt.setCancelled(true); } }
@EventHandler(ignoreCancelled = true) public static void onChestBreak(BlockBreakEvent event) { if (!canBeBroken(event.getBlock(), event.getPlayer())) { event.setCancelled(true); } }
@EventHandler(ignoreCancelled = true) public void onBlockBreak(BlockBreakEvent event) { Events.fireToCancel(event, new BreakBlockEvent(event, create(event.getPlayer()), event.getBlock())); if (event.isCancelled()) { playDenyEffect(event.getPlayer(), event.getBlock().getLocation().add(0.5, 1, 0.5)); } }
@EventHandler public void onBreak(BlockBreakEvent e) { if (ProtectionSystem.build(e.getPlayer(), e.getBlock().getLocation())) { e.setCancelled(true); } }
@EventHandler(ignoreCancelled=true) private void breakScoreboard(BlockBreakEvent event) { Block block = event.getBlock(); if (block.getType() == Material.WALL_SIGN) { if (block.hasMetadata("MGScoreboardSign")) { Minigame minigame = (Minigame)block.getMetadata("Minigame").get(0).value(); minigame.getScoreboardData().removeDisplay(block); } } } }
@EventHandler(ignoreCancelled = true) public static void onBlockDestroy(BlockBreakEvent event) { Block destroyed = event.getBlock(); Sign attachedRestrictedSign = getRestrictedSign(destroyed.getLocation()); if (attachedRestrictedSign == null) { return; } if (!canDestroy(event.getPlayer(), attachedRestrictedSign)) { event.setCancelled(true); } }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void blockBreak(BlockBreakEvent event) { storeEntry(event.getPlayer(), new RollbackEntry(event.getPlayer().getName(), event.getBlock(), EntryType.BLOCK_BREAK)); }
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onBlockBreak(BlockBreakEvent event) { Block block = event.getBlock(); Player player = event.getPlayer(); DGlobalPlayer dGlobalPlayer = plugin.getDPlayerCache().getByPlayer(player); GlobalProtection protection = plugin.getGlobalProtectionCache().getByBlock(block); if (protection != null) { if (protection.onBreak(dGlobalPlayer)) { event.setCancelled(true); } } }