use of org.lanternpowered.api.world.weather.WeatherUniverse in project LanternServer by LanternPowered.
the class CommandToggleDownfall method completeSpec.
@Override
public void completeSpec(PluginContainer pluginContainer, CommandSpec.Builder specBuilder) {
specBuilder.arguments(GenericArguments.flags().valueFlag(GenericArguments.world(CommandHelper.WORLD_KEY), "-world", "w").buildWith(GenericArguments.none())).executor((src, args) -> {
final LanternWorldProperties world = CommandHelper.getWorldProperties(src, args);
final WeatherUniverse weatherUniverse = world.getWorld().get().getWeatherUniverse().orElse(null);
final LanternWeather weather = (LanternWeather) weatherUniverse.getWeather();
if (weather.getOptions().getOrDefault(WeatherOptions.RAIN_STRENGTH).get() > 0) {
weatherUniverse.setWeather(Weathers.CLEAR);
} else {
weatherUniverse.setWeather(Weathers.RAIN);
}
return CommandResult.success();
});
}
Aggregations