Java Code Examples for org.bukkit.World#refreshChunk()

The following examples show how to use org.bukkit.World#refreshChunk() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WeatherOption.java    From SkyWarsReloaded with GNU General Public License v3.0 5 votes vote down vote up
@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);
	}
}
 
Example 2
Source File: WorldEditHandler.java    From uSkyBlock with GNU General Public License v3.0 5 votes vote down vote up
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());
    }
}