本文整理了Java中org.bukkit.Chunk.unload()
方法的一些代码示例,展示了Chunk.unload()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Chunk.unload()
方法的具体详情如下:
包路径:org.bukkit.Chunk
类名称:Chunk
方法名:unload
[英]Unloads and optionally saves the Chunk
[中]卸载并有选择地保存块
代码示例来源:origin: GlowstoneMC/Glowstone
@Override
public boolean unloadChunk(Chunk chunk) {
return chunk.unload();
}
代码示例来源:origin: AddstarMC/Minigames
public static void removeTreasure(Minigame minigame){
TreasureHuntModule thm = TreasureHuntModule.getMinigameModule(minigame);
thm.clearHints();
if(thm.hasTreasureLocation()){
Location old = thm.getTreasureLocation();
boolean loaded = false;
Chunk c = null;
if(!old.getWorld().isChunkInUse(old.getChunk().getX(), old.getChunk().getZ())){
old.getChunk().load();
loaded = true;
c = old.getChunk();
}
if(old.getBlock().getState() instanceof Chest){
Chest chest = (Chest) old.getBlock().getState();
chest.getInventory().clear();
}
old.getBlock().setType(Material.AIR);
if(loaded && !c.getWorld().isChunkInUse(c.getX(), c.getZ())){
c.unload();
}
thm.setTreasureLocation(null);
}
}
内容来源于网络,如有侵权,请联系作者删除!