org.bukkit.World#refreshChunk ( )源码实例Demo

下面列出了org.bukkit.World#refreshChunk ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: SkyWarsReloaded   文件: WeatherOption.java
@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);
	}
}
 
源代码2 项目: uSkyBlock   文件: WorldEditHandler.java
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());
    }
}