From a8221a68af390dcd16cb6ac620af92d2f8768071 Mon Sep 17 00:00:00 2001 From: Len <40720638+destro174@users.noreply.github.com> Date: Thu, 15 Aug 2024 17:49:45 +0200 Subject: [PATCH] Add reset option to pweather --- .../commands/admin/PlayerWeatherCommand.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/plugin/src/main/java/com/alttd/essentia/commands/admin/PlayerWeatherCommand.java b/plugin/src/main/java/com/alttd/essentia/commands/admin/PlayerWeatherCommand.java index d367b90..0e13931 100644 --- a/plugin/src/main/java/com/alttd/essentia/commands/admin/PlayerWeatherCommand.java +++ b/plugin/src/main/java/com/alttd/essentia/commands/admin/PlayerWeatherCommand.java @@ -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 aliases() { return List.of("pweather"); }