From e69d203b99570f76f62562120b984f9786bc9c81 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 5 Oct 2025 11:45:11 +0200 Subject: [PATCH] Add `clear` command to Piston Calculator to remove player-related data --- .../steamwar/bausystem/features/util/PistonCalculator.java | 4 +++- .../bausystem/features/util/PistonCalculatorCommand.java | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculator.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculator.java index 2b179f14..71fbdb8a 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculator.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculator.java @@ -147,10 +147,12 @@ public class PistonCalculator implements Listener { public void onPlayerQuit(PlayerQuitEvent event) { debounce.remove(event.getPlayer()); disablePistonCalculator.remove(event.getPlayer()); + } + public void clear(Player player) { Set toRemove = new HashSet<>(); pistOrders.forEach((location, pistOrder) -> { - pistOrder.server.removePlayer(event.getPlayer()); + pistOrder.server.removePlayer(player); if (pistOrder.server.getPlayers().isEmpty()) { toRemove.add(location); pistOrder.server.close(); diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculatorCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculatorCommand.java index bf387dd5..207c3fbd 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculatorCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculatorCommand.java @@ -59,4 +59,9 @@ public class PistonCalculatorCommand extends SWCommand { BauSystem.MESSAGE.send("PISTON_DISABLED", player); } } + + @Register("clear") + public void clearCommand(@Validator Player player) { + pistonCalculator.clear(player); + } }