Java Code Examples for org.bukkit.event.world.ChunkUnloadEvent#setCancelled()
The following examples show how to use
org.bukkit.event.world.ChunkUnloadEvent#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 WorldGuardExtraFlagsPlugin with MIT License | 5 votes |
@EventHandler(ignoreCancelled = true) public void onChunkUnloadEvent(ChunkUnloadEvent event) { World world = event.getWorld(); Chunk chunk = event.getChunk(); if (!this.plugin.getWorldGuardCommunicator().doUnloadChunkFlagCheck(world, chunk)) { event.setCancelled(true); } }
Example 2
Source File: ChunkListener.java From BedwarsRel with GNU General Public License v3.0 | 5 votes |
@EventHandler public void onUnload(ChunkUnloadEvent unload) { Game game = BedwarsRel.getInstance().getGameManager() .getGameByChunkLocation(unload.getChunk().getX(), unload.getChunk().getZ()); if (game == null) { return; } if (game.getState() != GameState.RUNNING) { return; } unload.setCancelled(true); }
Example 3
Source File: BukkitQueue_0.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@EventHandler public static void onChunkUnload(ChunkUnloadEvent event) { Chunk chunk = event.getChunk(); long pair = MathMan.pairInt(chunk.getX(), chunk.getZ()); Long lastLoad = keepLoaded.get(pair); if (lastLoad != null) { if (Fawe.get().getTimer().getTickStart() - lastLoad < 10000) { event.setCancelled(true); } else { keepLoaded.remove(pair); } } }
Example 4
Source File: BlockListener.java From civcraft with GNU General Public License v2.0 | 5 votes |
@EventHandler(priority = EventPriority.HIGH) public void onChunkUnloadEvent(ChunkUnloadEvent event) { Boolean persist = CivGlobal.isPersistChunk(event.getChunk()); if (persist != null && persist == true) { event.setCancelled(true); } }