本文整理汇总了Java中org.bukkit.event.world.ChunkLoadEvent.getWorld方法的典型用法代码示例。如果您正苦于以下问题:Java ChunkLoadEvent.getWorld方法的具体用法?Java ChunkLoadEvent.getWorld怎么用?Java ChunkLoadEvent.getWorld使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.world.ChunkLoadEvent
的用法示例。
在下文中一共展示了ChunkLoadEvent.getWorld方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onChunkLoad
import org.bukkit.event.world.ChunkLoadEvent; //导入方法依赖的package包/类
@EventHandler
public void onChunkLoad(ChunkLoadEvent e) {
if (!e.isNewChunk())
return;
Chunk chunk = e.getChunk();
int x = chunk.getX() * 16;
int z = chunk.getZ() * 16;
int y = chunk.getWorld().getHighestBlockYAt(x + 8, z + 2);
Location loc = new Location(e.getWorld(), x + 8, y, z + 2);
Random r = new Random();
// 0.2% chance of spawning shelter on generating new chunks
if (r.nextInt(1000) < 2) {
FalloutShelter s = new FalloutShelter(loc.clone());
s.generateFalloutShelter();
}
}
示例2: onChunkLoad
import org.bukkit.event.world.ChunkLoadEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onChunkLoad(ChunkLoadEvent e) {
if (ASkyBlock.getIslandWorld() == null || e.getWorld() != ASkyBlock.getIslandWorld()) {
if (DEBUG)
Bukkit.getLogger().info("DEBUG: not right world");
return;
}
if (e.getChunk().getBlock(0, 0, 0).getType().equals(Material.BEDROCK)) {
e.getWorld().regenerateChunk(e.getChunk().getX(), e.getChunk().getZ());
Bukkit.getLogger().warning("Regenerating superflat chunk at " + (e.getChunk().getX() * 16) + "," + (e.getChunk().getZ() * 16));
}
}
示例3: onChunkLoadEvent
import org.bukkit.event.world.ChunkLoadEvent; //导入方法依赖的package包/类
@EventHandler
public void onChunkLoadEvent(ChunkLoadEvent event) {
World w = event.getWorld();
for (SedWorld ww: sedWorldList) {
if (ww.world.equals(w)) {
Chunk c = event.getChunk();
ww.load(c.getX(), c.getZ());
}
}
}