當前位置: 首頁>>代碼示例>>Java>>正文


Java ChunkUnloadEvent.setCancelled方法代碼示例

本文整理匯總了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());
		}
	}
}
 
開發者ID:DevotedMC,項目名稱:ExilePearl,代碼行數:22,代碼來源:PlayerListener.java

示例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);
    }
}
 
開發者ID:IntellectualSites,項目名稱:PlotSquared,代碼行數:19,代碼來源:ChunkListener.java

示例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);
	}
}
 
開發者ID:jiongjionger,項目名稱:NeverLag,代碼行數:12,代碼來源:HotChunkHolder.java

示例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;
		}
	}
}
 
開發者ID:isokissa3,項目名稱:WorldGuardExtraFlagsPlugin,代碼行數:13,代碼來源:WorldListener.java

示例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();
    }
}
 
開發者ID:CanaryBukkitTeam,項目名稱:CanaryBukkit,代碼行數:11,代碼來源:CanaryWorldListener.java

示例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);
}
 
開發者ID:BedwarsRel,項目名稱:BedwarsRel,代碼行數:16,代碼來源:ChunkListener.java

示例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);
        }
    }
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:14,代碼來源:BukkitQueue_0.java

示例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);
		}	
	}
	
}
 
開發者ID:C4K3,項目名稱:Portals,代碼行數:12,代碼來源:ChunkUnload.java

示例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);
	}
}
 
開發者ID:netizen539,項目名稱:civcraft,代碼行數:8,代碼來源:BlockListener.java

示例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);
    }
}
 
開發者ID:GelandiAssociation,項目名稱:EscapeLag,代碼行數:7,代碼來源:ChunkKeeper.java

示例11: onChunkUnload

import org.bukkit.event.world.ChunkUnloadEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.LOWEST)
public void onChunkUnload(ChunkUnloadEvent event)
{
    event.setCancelled(true);
}
 
開發者ID:SamaGames,項目名稱:Hub,代碼行數:6,代碼來源:WorldEditionListener.java

示例12: onChunkUnload

import org.bukkit.event.world.ChunkUnloadEvent; //導入方法依賴的package包/類
@EventHandler
public void onChunkUnload(ChunkUnloadEvent event) {
    if (processChunk(event.getChunk(), true)) {
        event.setCancelled(true);
    }
}
 
開發者ID:Mayomi,項目名稱:PlotSquared-Chinese,代碼行數:7,代碼來源:ChunkListener.java

示例13: chunkUnloadEvent

import org.bukkit.event.world.ChunkUnloadEvent; //導入方法依賴的package包/類
@EventHandler
public void chunkUnloadEvent(ChunkUnloadEvent event) {
    if (StableMaster.teleportChunk.contains(event.getChunk()))
        event.setCancelled(true);
}
 
開發者ID:RobotoRaccoon,項目名稱:StableMaster,代碼行數:6,代碼來源:ChunkListener.java

示例14: onChunkUnload

import org.bukkit.event.world.ChunkUnloadEvent; //導入方法依賴的package包/類
@EventHandler
public void onChunkUnload(ChunkUnloadEvent event) {
    if (this.chunks.contains(event.getChunk())) {
        event.setCancelled(true);
    }
}
 
開發者ID:GoldRushMC,項目名稱:GoldRushPlugin,代碼行數:7,代碼來源:BlockFinder.java


注:本文中的org.bukkit.event.world.ChunkUnloadEvent.setCancelled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。