package emu.grasscutter.command.commands; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.props.ClimateType; import emu.grasscutter.server.packet.send.PacketSceneAreaWeatherNotify; import java.util.List; @Command(label = "weather", usage = "weather [climateId]", description = "Changes the weather.", aliases = {"w"}, permission = "player.weather") public final class WeatherCommand implements CommandHandler { @Override public void execute(GenshinPlayer sender, List args) { if (sender == null) { CommandHandler.sendMessage(null, "Run this command in-game."); return; } if (args.size() < 1) { CommandHandler.sendMessage(sender, "Usage: weather [climateId]"); return; } try { int weatherId = Integer.parseInt(args.get(0)); int climateId = args.size() > 1 ? Integer.parseInt(args.get(1)) : 1; ClimateType climate = ClimateType.getTypeByValue(climateId); sender.getScene().setWeather(weatherId); sender.getScene().setClimate(climate); sender.getScene().broadcastPacket(new PacketSceneAreaWeatherNotify(sender)); CommandHandler.sendMessage(sender, "Changed weather to " + weatherId + " with climate " + climateId); } catch (NumberFormatException ignored) { CommandHandler.sendMessage(sender, "Invalid ID."); } } }