下面列出了org.bukkit.World#refreshChunk ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@SuppressWarnings("deprecation")
@Override
public void completeOption() {
Vote weather = gameMap.getWeatherOption().getVoted();
WeatherType w = WeatherType.CLEAR;
if (weather != Vote.WEATHERSUN) {
w = WeatherType.DOWNFALL;
}
if (weather == Vote.WEATHERTHUNDER) {
gameMap.setThunderStorm(true);
gameMap.setNextStrike(Util.get().getRandomNum(3, 20));
gameMap.setStrikeCounter(0);
} else if (weather == Vote.WEATHERSNOW) {
World world = gameMap.getAlivePlayers().get(0).getWorld();
for (int x = -200; x < 200; x++) {
for (int z = -200; z < 200; z++) {
if (SkyWarsReloaded.getNMS().getVersion() < 13) {
world.setBiome(x, z, Biome.valueOf("ICE_MOUNTAINS"));
} else {
world.setBiome(x, z, Biome.SNOWY_TUNDRA);
}
}
}
List<Chunk> chunks = Util.get().getChunks(world);
for (Chunk chunk: chunks) {
world.refreshChunk(chunk.getX(), chunk.getZ());
}
}
for (Player player: gameMap.getAllPlayers()) {
player.setPlayerWeather(w);
}
}
public static void refreshRegion(Location location) {
ProtectedRegion region = WorldGuardHandler.getIslandRegionAt(location);
World world = location.getWorld();
Region cube = getRegion(world, region);
for (BlockVector2 chunk : cube.getChunks()) {
world.refreshChunk(chunk.getBlockX(), chunk.getBlockZ());
}
}