@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onBlockGrow(final BlockGrowEvent event) { Block b = event.getBlock(); if (PlotManager.isPlotWorld(b)) { String id = PlotManager.getPlotId(b.getLocation()); if (id.equalsIgnoreCase("")) { event.setCancelled(true); } } }
public static void handleBlockGrowEvent(World world, int x, int y, int z, int type, int data) { Block block = new BukkitBlock(new BukkitChunk(world.getChunkFromBlockCoords(x, z)), x, y, z); BukkitBlockState state = (BukkitBlockState) block.getState(); state.setTypeId(type); state.setRawData((byte) data); BlockGrowEvent event = new BlockGrowEvent(block, state); Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled()) { state.update(true); } }
@EventHandler public void BlockGrowEvent(BlockGrowEvent event) { if (!arena.getRegion().isInside(event.getBlock().getLocation()) || arena.getEditMode()) return; event.setCancelled(true); }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onBlockGrow(BlockGrowEvent event) { addToCheck(event.getBlock(), event.getBlock().getState()); }