org.bukkit.event.block.BlockFormEvent Java Examples
The following examples show how to use
org.bukkit.event.block.BlockFormEvent.
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: BlockFromToListener.java From IridiumSkyblock with GNU General Public License v2.0 | 6 votes |
@EventHandler public void onBlockFrom(BlockFormEvent event) { try { final Block block = event.getBlock(); final Location location = block.getLocation(); final IslandManager islandManager = IridiumSkyblock.getIslandManager(); final Island island = islandManager.getIslandViaLocation(location); if (island == null) return; if (!event.getNewState().getType().equals(Material.OBSIDIAN)) return; island.failedGenerators.add(location); } catch (Exception ex) { IridiumSkyblock.getInstance().sendErrorMessage(ex); } }
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 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 #4
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 #5
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 #6
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 #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: 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 #9
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 #10
Source File: BlockTransformListener.java From ProjectAres with GNU Affero General Public License v3.0 | 4 votes |
@EventWrapper public void onBlockForm(final BlockFormEvent event) { callEvent(event, event.getBlock().getState(), event.getNewState()); }
Example #11
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 #12
Source File: LoggingManager.java From Survival-Games with GNU General Public License v3.0 | 4 votes |
@EventHandler(priority = EventPriority.MONITOR) public void blockChanged(BlockFormEvent e){ logBlockCreated(e.getBlock()); }
Example #13
Source File: BlockTransformListener.java From PGM with GNU Affero General Public License v3.0 | 4 votes |
@EventWrapper public void onBlockForm(final BlockFormEvent event) { this.callEvent( new BlockTransformEvent(event, event.getBlock().getState(), event.getNewState())); }
Example #14
Source File: BlockEventHandler.java From GriefDefender with MIT License | 4 votes |
@EventHandler(priority = EventPriority.LOWEST) public void onBlockForm(BlockFormEvent event) { CommonBlockEventHandler.getInstance().handleBlockModify(event, event.getBlock(), event.getNewState()); }
Example #15
Source File: WorldFreeze.java From CardinalPGM with MIT License | 4 votes |
@EventHandler public void onBlockForm(BlockFormEvent event) { if (!match.isRunning()) { event.setCancelled(true); } }
Example #16
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); } }
Example #17
Source File: EventForwarder.java From BlueMap with MIT License | 4 votes |
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onBlockChange(BlockFormEvent evt) { onBlockChange(evt.getBlock().getLocation()); }