mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-17 09:25:06 +01:00
Add a changing weather id
This commit is contained in:
@@ -8,7 +8,7 @@ import emu.grasscutter.server.packet.send.PacketSceneAreaWeatherNotify;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Command(label = "weather", usage = "weather <weatherId>",
|
||||
@Command(label = "weather", usage = "weather <weatherId> [climateId]",
|
||||
description = "Changes the weather.", aliases = {"w"}, permission = "player.weather")
|
||||
public final class WeatherCommand implements CommandHandler {
|
||||
|
||||
@@ -20,20 +20,22 @@ public final class WeatherCommand implements CommandHandler {
|
||||
}
|
||||
|
||||
if (args.size() < 1) {
|
||||
CommandHandler.sendMessage(sender, "Usage: weather <weatherId>");
|
||||
CommandHandler.sendMessage(sender, "Usage: weather <weatherId> [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(weatherId);
|
||||
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);
|
||||
CommandHandler.sendMessage(sender, "Changed weather to " + weatherId + " with climate " + climateId);
|
||||
} catch (NumberFormatException ignored) {
|
||||
CommandHandler.sendMessage(sender, "Invalid weather ID.");
|
||||
CommandHandler.sendMessage(sender, "Invalid ID.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user