本文整理匯總了Java中org.bukkit.event.world.ChunkUnloadEvent.setCancelled方法的典型用法代碼示例。如果您正苦於以下問題:Java ChunkUnloadEvent.setCancelled方法的具體用法?Java ChunkUnloadEvent.setCancelled怎麽用?Java ChunkUnloadEvent.setCancelled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.event.world.ChunkUnloadEvent
的用法示例。
在下文中一共展示了ChunkUnloadEvent.setCancelled方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onChunkUnload
import org.bukkit.event.world.ChunkUnloadEvent; //導入方法依賴的package包/類
/**
* Prevent chunk that contain pearls from unloading
* @param e The event args
*/
@EventHandler(priority=EventPriority.HIGH, ignoreCancelled = true)
public void onChunkUnload(ChunkUnloadEvent e) {
Chunk chunk = e.getChunk();
for (Entity entity : chunk.getEntities()) {
if (!(entity instanceof Item)) {
continue;
}
Item item = (Item)entity;
ExilePearl pearl = pearlApi.getPearlFromItemStack(item.getItemStack());
if (pearl != null) {
e.setCancelled(true);
pearlApi.log("Prevented chunk (%d, %d) from unloading because it contained an exile pearl for player %s.", chunk.getX(), chunk.getZ(), pearl.getPlayerName());
}
}
}
示例2: onChunkUnload
import org.bukkit.event.world.ChunkUnloadEvent; //導入方法依賴的package包/類
@EventHandler
public void onChunkUnload(ChunkUnloadEvent event) {
if (ignoreUnload) {
return;
}
if (Settings.Chunk_Processor.AUTO_TRIM) {
Chunk chunk = event.getChunk();
String world = chunk.getWorld().getName();
if (PS.get().hasPlotArea(world)) {
if (unloadChunk(world, chunk, true)) {
return;
}
}
}
if (processChunk(event.getChunk(), true)) {
event.setCancelled(true);
}
}
示例3: onUnloadChunk
import org.bukkit.event.world.ChunkUnloadEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onUnloadChunk(ChunkUnloadEvent e) {
if (!cm.hotChunkEnabled || NeverLag.getTpsWatcher().getAverageTPS() < cm.hotChunkTpsThreshold) {
return;
}
ChunkInfo chunkInfo = new ChunkInfo(e.getChunk());
if (hotChunkRecord.contains(chunkInfo)) {
e.setCancelled(true);
this.addHotChunkUnloadCount(chunkInfo);
}
}
示例4: onChunkUnloadEvent
import org.bukkit.event.world.ChunkUnloadEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onChunkUnloadEvent(ChunkUnloadEvent event)
{
for (ProtectedRegion region : WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionManager(event.getWorld()).getApplicableRegions(new ProtectedCuboidRegion("UnloadChunkFlagTester", new BlockVector(event.getChunk().getX() * 16, 0, event.getChunk().getZ() * 16), new BlockVector(event.getChunk().getX() * 16 + 15, 256, event.getChunk().getZ() * 16 + 15))))
{
if (region.getFlag(FlagUtils.CHUNK_UNLOAD) == State.DENY)
{
event.setCancelled(true);
break;
}
}
}
示例5: onChunkUnload
import org.bukkit.event.world.ChunkUnloadEvent; //導入方法依賴的package包/類
@HookHandler(priority = Priority.CRITICAL, ignoreCanceled = true)
public void onChunkUnload(final ChunkUnloadHook hook) {
ChunkUnloadEvent event =
new ChunkUnloadEvent(new CanaryChunk(hook.getChunk(), new CanaryWorld(hook.getWorld())));
event.setCancelled(hook.isCanceled());
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
hook.setCanceled();
}
}
示例6: onUnload
import org.bukkit.event.world.ChunkUnloadEvent; //導入方法依賴的package包/類
@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);
}
示例7: onChunkUnload
import org.bukkit.event.world.ChunkUnloadEvent; //導入方法依賴的package包/類
@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);
}
}
}
示例8: onChunkUnload
import org.bukkit.event.world.ChunkUnloadEvent; //導入方法依賴的package包/類
@EventHandler
public void onChunkUnload(ChunkUnloadEvent event) {
/* Do not let chunks containing entities about to be teleported unload */
for (Entity entity : event.getChunk().getEntities()) {
if (Portals.justTeleportedEntities.contains(entity.getUniqueId())) {
event.setCancelled(true);
}
}
}
示例9: onChunkUnloadEvent
import org.bukkit.event.world.ChunkUnloadEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGH)
public void onChunkUnloadEvent(ChunkUnloadEvent event) {
Boolean persist = CivGlobal.isPersistChunk(event.getChunk());
if (persist != null && persist == true) {
event.setCancelled(true);
}
}
示例10: onChunkUnload
import org.bukkit.event.world.ChunkUnloadEvent; //導入方法依賴的package包/類
@EventHandler
public void onChunkUnload(ChunkUnloadEvent event) {
if (ShouldKeepList.contains(event.getChunk()) && ConfigOptimize.ChunkKeeperenable == true) {
event.setCancelled(true);
}
}
示例11: onChunkUnload
import org.bukkit.event.world.ChunkUnloadEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.LOWEST)
public void onChunkUnload(ChunkUnloadEvent event)
{
event.setCancelled(true);
}
示例12: onChunkUnload
import org.bukkit.event.world.ChunkUnloadEvent; //導入方法依賴的package包/類
@EventHandler
public void onChunkUnload(ChunkUnloadEvent event) {
if (processChunk(event.getChunk(), true)) {
event.setCancelled(true);
}
}
示例13: chunkUnloadEvent
import org.bukkit.event.world.ChunkUnloadEvent; //導入方法依賴的package包/類
@EventHandler
public void chunkUnloadEvent(ChunkUnloadEvent event) {
if (StableMaster.teleportChunk.contains(event.getChunk()))
event.setCancelled(true);
}
示例14: onChunkUnload
import org.bukkit.event.world.ChunkUnloadEvent; //導入方法依賴的package包/類
@EventHandler
public void onChunkUnload(ChunkUnloadEvent event) {
if (this.chunks.contains(event.getChunk())) {
event.setCancelled(true);
}
}