Java Code Examples for org.bukkit.event.block.BlockFormEvent#setCancelled()
The following examples show how to use
org.bukkit.event.block.BlockFormEvent#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: WorldListener.java From BedWars with GNU Lesser General Public License v3.0 | 6 votes |
@EventHandler public void onForm(BlockFormEvent event) { if (event.isCancelled()) { return; } if (event.getNewState().getType() == Material.SNOW) { return; } for (String s : Main.getGameNames()) { Game game = Main.getGame(s); if (game.getStatus() == GameStatus.RUNNING || game.getStatus() == GameStatus.GAME_END_CELEBRATING) { if (GameCreator.isInArea(event.getBlock().getLocation(), game.getPos1(), game.getPos2())) { if (!game.isBlockAddedDuringGame(event.getBlock().getLocation())) { event.setCancelled(true); } return; } } } }
Example 2
Source File: WorldListener.java From BedWars with GNU Lesser General Public License v3.0 | 6 votes |
@EventHandler public void onForm(BlockFormEvent event) { if (event.isCancelled()) { return; } if (event.getNewState().getType() == Material.SNOW) { return; } for (String s : Main.getGameNames()) { Game game = Main.getGame(s); if (game.getStatus() == GameStatus.RUNNING || game.getStatus() == GameStatus.GAME_END_CELEBRATING) { if (GameCreator.isInArea(event.getBlock().getLocation(), game.getPos1(), game.getPos2())) { if (!game.isBlockAddedDuringGame(event.getBlock().getLocation())) { event.setCancelled(true); } return; } } } }
Example 3
Source File: BlockListener.java From BedwarsRel with GNU General Public License v3.0 | 6 votes |
@EventHandler(ignoreCancelled = true) public void onForm(BlockFormEvent form) { if (form.getNewState().getType() != Material.SNOW) { return; } Game game = BedwarsRel.getInstance().getGameManager().getGameByLocation(form.getBlock().getLocation()); if (game == null) { return; } if (game.getState() == GameState.STOPPED) { return; } form.setCancelled(true); }
Example 4
Source File: BlockListener.java From civcraft with GNU General Public License v2.0 | 6 votes |
@EventHandler(priority = EventPriority.NORMAL) public void OnBlockFormEvent (BlockFormEvent event) { /* Disable cobblestone generators. */ if (ItemManager.getId(event.getNewState()) == CivData.COBBLESTONE) { ItemManager.setTypeId(event.getNewState(), CivData.GRAVEL); return; } Chunk spreadChunk = event.getNewState().getChunk(); coord.setX(spreadChunk.getX()); coord.setZ(spreadChunk.getZ()); coord.setWorldname(spreadChunk.getWorld().getName()); TownChunk tc = CivGlobal.getTownChunk(coord); if (tc == null) { return; } if (tc.perms.isFire() == false) { if(event.getNewState().getType() == Material.FIRE) { event.setCancelled(true); } } }
Example 5
Source File: SnowForm.java From GlobalWarming with GNU Lesser General Public License v3.0 | 5 votes |
@EventHandler public void blockFormEvent(BlockFormEvent event) { if (event.getNewState().getType() == Material.SNOW) { WorldClimateEngine climateEngine = ClimateEngine.getInstance().getClimateEngine(event.getBlock().getWorld().getUID()); if (climateEngine != null && climateEngine.isEffectEnabled(ClimateEffectType.SNOW_FORMATION)) { double temperature = climateEngine.getTemperature(); if (event.getBlock().getY() < heightMap.getValue(temperature)) { event.setCancelled(true); } } } }
Example 6
Source File: IceForm.java From GlobalWarming with GNU Lesser General Public License v3.0 | 5 votes |
@EventHandler public void blockFormEvent(BlockFormEvent event) { if (event.getNewState().getType() == Material.ICE) { WorldClimateEngine climateEngine = ClimateEngine.getInstance().getClimateEngine(event.getBlock().getWorld().getUID()); if (climateEngine != null && climateEngine.isEffectEnabled(ClimateEffectType.ICE_FORMATION)) { if (event.getBlock().getY() < heightMap.getValue(climateEngine.getTemperature())) { event.setCancelled(true); } } } }
Example 7
Source File: BukkitPlotListener.java From PlotMe-Core with GNU General Public License v3.0 | 5 votes |
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onBlockForm(BlockFormEvent 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 8
Source File: CoreObjective.java From CardinalPGM with MIT License | 5 votes |
@EventHandler public void onObsidianForm(BlockFormEvent event) { if (this.lava.contains(event.getBlock())) { if (event.getNewState().getType().equals(Material.OBSIDIAN)) { event.setCancelled(true); } } }
Example 9
Source File: EnvironmentControlListener.java From ProjectAres with GNU Affero General Public License v3.0 | 4 votes |
@EventHandler(priority = EventPriority.HIGH) public void noForm(final BlockFormEvent event) { event.setCancelled(true); }
Example 10
Source File: WorldFreeze.java From CardinalPGM with MIT License | 4 votes |
@EventHandler public void onBlockForm(BlockFormEvent event) { if (!match.isRunning()) { event.setCancelled(true); } }
Example 11
Source File: BlockEventRegion.java From CardinalPGM with MIT License | 4 votes |
@EventHandler public void onBlockForm(BlockFormEvent event) { if (filter.evaluate(event.getBlock(), event).equals(FilterState.DENY) && region.contains(new BlockRegion(null, event.getBlock().getLocation().toVector()))) { event.setCancelled(true); } }