Add reset option to pweather

This commit is contained in:
Len 2024-08-15 17:49:45 +02:00
parent 29559b83c4
commit a8221a68af

View File

@ -29,7 +29,16 @@ public class PlayerWeatherCommand implements EssentiaCommand {
Commands.literal(commandName)
.requires(
commandSourceStack -> commandSourceStack.getSender().hasPermission("essentia.command.admin." + commandName) &&
commandSourceStack.getSender() instanceof Player
commandSourceStack.getSender() instanceof Player
)
.then(
Commands.literal("reset")
.executes(commandContext -> {
if (commandContext.getSource().getSender() instanceof Player player)
resetWeather(player);
return 1;
})
)
.then(
Commands.argument("weather", new WeatherArgument())
@ -60,6 +69,10 @@ public class PlayerWeatherCommand implements EssentiaCommand {
target.setPlayerWeather(weatherType);
}
void resetWeather(Player player) {
player.resetPlayerWeather();
}
public List<String> aliases() {
return List.of("pweather");
}