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); + } }