org.bukkit.WeatherType Java Examples
The following examples show how to use
org.bukkit.WeatherType.
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: NoWeather.java From HubBasics with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void onEnable() { Bukkit.getWorlds().forEach(world -> { Section section = getConfig().getSection(world.getName()); if (section == null) return; if (!section.getBoolean("Enabled", false)) return; WeatherType type; try { type = WeatherType.valueOf(section.getString("State", "CLEAR")); } catch (IllegalArgumentException ex) { logger.warn("Invalid weather state '" + section.getString("State") + "' for the world '" + world.getName() + "'."); type = WeatherType.CLEAR; } worldStates.put(world.getName(), type); if (type == WeatherType.CLEAR) { world.setWeatherDuration(0); } else { world.setWeatherDuration(100); } }); }
Example #2
Source File: GameCreator.java From BedWars with GNU Lesser General Public License v3.0 | 5 votes |
private String setArenaWeather(String arenaWeather) { arenaWeather = arenaWeather.toUpperCase(); WeatherType c = null; if (!arenaWeather.equalsIgnoreCase("default")) { try { c = WeatherType.valueOf(arenaWeather); } catch (Exception e) { return i18n("admin_command_invalid_arena_weather"); } } game.setArenaWeather(c); return i18n("admin_command_arena_weather_set").replace("%weather%", c == null ? "default" : c.name()); }
Example #3
Source File: GameCreator.java From BedWars with GNU Lesser General Public License v3.0 | 5 votes |
private String setArenaWeather(String arenaWeather) { arenaWeather = arenaWeather.toUpperCase(); WeatherType c = null; if (!arenaWeather.equalsIgnoreCase("default")) { try { c = WeatherType.valueOf(arenaWeather); } catch (Exception e) { return i18n("admin_command_invalid_arena_weather"); } } game.setArenaWeather(c); return i18n("admin_command_arena_weather_set").replace("%weather%", c == null ? "default" : c.name()); }
Example #4
Source File: WeatherOption.java From SkyWarsReloaded with GNU General Public License v3.0 | 5 votes |
@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 #5
Source File: NoWeather.java From HubBasics with GNU Lesser General Public License v3.0 | 5 votes |
@EventHandler public void onWeather(WeatherChangeEvent event) { WeatherType type = this.worldStates.get(event.getWorld().getName()); if (type == null) return; if (type == WeatherType.CLEAR && event.toWeatherState()) { event.setCancelled(true); } else if (type == WeatherType.DOWNFALL && !event.toWeatherState()) { event.setCancelled(true); } }
Example #6
Source File: NoWeatherChangeFeature.java From VoxelGamesLibv2 with MIT License | 4 votes |
public void setWeather(WeatherType weather) { this.weather = weather; }
Example #7
Source File: Game.java From BedWars with GNU Lesser General Public License v3.0 | 2 votes |
/** * @return */ WeatherType getArenaWeather();
Example #8
Source File: Game.java From BedWars with GNU Lesser General Public License v3.0 | 2 votes |
/** * @return */ WeatherType getArenaWeather();