From 09ba3a091b343fe358c56e6260a99359c68763a5 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 5 Jan 2021 13:31:07 +0100 Subject: [PATCH] Fixing even more Things --- .../steamwar/bausystem/commands/CommandDetonator.java | 11 ++++++++--- .../src/de/steamwar/bausystem/world/Detonator.java | 7 ++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandDetonator.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandDetonator.java index bd8317e..be118ac 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandDetonator.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandDetonator.java @@ -33,7 +33,8 @@ public class CommandDetonator implements CommandExecutor { private void help(Player player) { player.sendMessage("§8/§edetonator wand §8- §7Legt den Fernzünder ins Inventar"); player.sendMessage("§8/§edetonator detonate §8- §7Benutzt den Fernzünder"); - player.sendMessage("§8/§edetonator reset §8- §7Löscht alle markierten Positionen"); + player.sendMessage("§8/§edetonator reset §8- §7Lösche alle markierten Positionen"); + player.sendMessage("§8/§edetonator remove §8- §7Entferne den Fernzünder"); } private boolean permissionCheck(Player player) { @@ -65,16 +66,20 @@ public class CommandDetonator implements CommandExecutor { player.updateInventory(); Detonator.getDetonator(player); break; - case "delete": - case "reset": case "remove": Detonator.deleteDetonator(player); + player.getInventory().removeItem(Detonator.WAND); break; case "detonate": case "click": case "use": Detonator.getDetonator(player).execute(); break; + case "clear": + case "delete": + case "reset": + Detonator.getDetonator(player).clearLocs(); + break; default: help(player); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/Detonator.java b/BauSystem_Main/src/de/steamwar/bausystem/world/Detonator.java index 34f39a4..edc0409 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/Detonator.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/Detonator.java @@ -163,7 +163,8 @@ public class Detonator implements Listener { @EventHandler public void onPlayerQuit(PlayerQuitEvent event) { - deleteDetonator(event.getPlayer()); + if(event.getPlayer().equals(player)) + deleteDetonator(player); } Set getLocations() { @@ -174,6 +175,10 @@ public class Detonator implements Listener { return player; } + public void clearLocs() { + locs.clear(); + } + void print(String message, boolean withSize){ if(withSize) getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message + " §8" + getLocations().size()));