Java Code Examples for org.bukkit.event.block.BlockSpreadEvent#setCancelled()
The following examples show how to use
org.bukkit.event.block.BlockSpreadEvent#setCancelled() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IslandGuard.java From askyblock with GNU General Public License v2.0 | 6 votes |
/** * Prevent fire spread * @param e - event */ @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBlockSpread(BlockSpreadEvent e) { if (DEBUG) { plugin.getLogger().info(e.getEventName()); plugin.getLogger().info(e.getSource().getType().toString()); } if (e.getSource().getType() == Material.FIRE) { if (!inWorld(e.getBlock())) { //plugin.getLogger().info("DEBUG: Not in world"); return; } if (actionAllowed(e.getBlock().getLocation(), SettingsFlag.FIRE_SPREAD)) { return; } e.setCancelled(true); } }
Example 2
Source File: BlockListener.java From BedwarsRel with GNU General Public License v3.0 | 5 votes |
@EventHandler(ignoreCancelled = true) public void onSpread(BlockSpreadEvent spread) { if (spread.getBlock() == null) { return; } Game game = BedwarsRel.getInstance().getGameManager() .getGameByLocation(spread.getBlock().getLocation()); if (game == null) { return; } if (game.getState() != GameState.RUNNING) { return; } if (spread.getNewState() == null || spread.getSource() == null) { return; } if (spread.getNewState().getType().equals(Material.FIRE)) { spread.setCancelled(true); return; } if (game.getRegion().isPlacedBlock(spread.getSource())) { game.getRegion().addPlacedBlock(spread.getBlock(), spread.getBlock().getState()); } else { game.getRegion().addPlacedUnbreakableBlock(spread.getBlock(), spread.getBlock().getState()); } }
Example 3
Source File: DWorldListener.java From DungeonsXL with GNU General Public License v3.0 | 5 votes |
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onBlockSpread(BlockSpreadEvent event) { Block block = event.getSource(); if (plugin.isInstance(block.getWorld()) && VanillaItem.VINE.is(block)) { event.setCancelled(true); } }
Example 4
Source File: ShopItemListener.java From ShopChest with MIT License | 5 votes |
@EventHandler(priority = EventPriority.HIGH) public void onBlockSpread(BlockSpreadEvent e) { Block newBlock = e.getNewState().getBlock(); if (shopUtils.isShop(newBlock.getLocation()) || shopUtils.isShop(newBlock.getRelative(BlockFace.DOWN).getLocation())) { e.setCancelled(true); } }
Example 5
Source File: BukkitPlotListener.java From PlotMe-Core with GNU General Public License v3.0 | 5 votes |
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onBlockSpread(BlockSpreadEvent event) { Location location = BukkitUtil.adapt(event.getBlock().getLocation()); if (manager.isPlotWorld(location)) { PlotId id = manager.getPlotId(location); if (id == null) { event.setCancelled(true); } else { event.setCancelled(api.isPlotLocked(id)); } } }
Example 6
Source File: EnvironmentControlListener.java From ProjectAres with GNU Affero General Public License v3.0 | 4 votes |
@EventHandler(priority = EventPriority.HIGH) public void noSpread(final BlockSpreadEvent event) { event.setCancelled(true); }
Example 7
Source File: GlobalProtectionListener.java From DungeonsXL with GNU General Public License v3.0 | 4 votes |
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onBlockSpread(BlockSpreadEvent event) { if (DPortal.getByBlock(plugin, event.getBlock()) != null) { event.setCancelled(true); } }
Example 8
Source File: BlockEventRegion.java From CardinalPGM with MIT License | 4 votes |
@EventHandler public void onBlockSpread(BlockSpreadEvent event) { if (filter.evaluate(event.getBlock(), event).equals(FilterState.DENY) && region.contains(new BlockRegion(null, event.getBlock().getLocation().toVector()))) { event.setCancelled(true); } }