From ec6e75478696ea044eb1b491d25f7b1b98237b7c Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 19 Dec 2021 14:14:00 +0100 Subject: [PATCH] Update Simulator to Message System Signed-off-by: yoyosource --- BauSystem_Main/src/BauSystem.properties | 80 +++++++++- .../features/simulator/SimulatorCommand.java | 109 +++++++------- .../features/simulator/TNTSimulator.java | 137 ++++++++++-------- .../simulator/TNTSimulatorListener.java | 8 +- .../features/tracer/TraceCommand.java | 4 +- .../bausystem/features/world/StopCommand.java | 3 +- 6 files changed, 217 insertions(+), 124 deletions(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 58be90f7..2861b019 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -218,7 +218,6 @@ GUI_EDITOR_ITEM_MORE=§eMehr Items GUI_EDITOR_TITLE_MORE=Item auswählen # Script - ## Errors SCRIPT_SLEEP_ERROR = §cFüge ein sleep in dein Script ein SCRIPT_COMMAND_ERROR_FIRST_ARG_NOVAR = §cDas erste Argument fehlt und sollte eine Variable sein @@ -504,6 +503,85 @@ UNSIGN_HELP=§8/§eunsign §8- §7Mache ein Buch beschreibbar # Simulator SIMULATOR_GUI_ITEM_NAME = §eTNT Simulator +SIMULATOR_HELP = §8/§esimulator §8-§7 Legt dir den Simulatorstab ins Inventar +SIMULATOR_START_HELP = §8/§esimulator start §8-§7 Startet die Simulation +SIMULATOR_GUI_HELP = §8/§esimulator gui §8-§7 Öffnet die GUI +SIMULATOR_DELETE_HELP = §8/§esimulator delete §8-§7 Löscht alle TNT +SIMULATOR_SAVE_HELP = §8/§esimulator save §8<§eName§8> §8-§7 Speichert den Simulator +SIMULATOR_LOAD_HELP = §8/§esimulator load §8<§eName§8> §8-§7 Lädt den Simulator +SIMULATOR_LIST_HELP = §8/§esimulator list §8-§7 Listet alle gespeicherten Simulator +SIMULATOR_REMOVE_HELP = §8/§esimulator remove §8<§eName§8> §8-§7 Löscht den Simulator +SIMULATOR_NO_PERMS = §cDu darfst hier nicht den Simulator nutzen + +SIMULATOR_DELETE_TNT = §7Alle TNT wurden gelöscht +SIMULATOR_SAVE = §7Simulator §e{0} §7wurde gespeichert +SIMULATOR_LOAD = §7Simulator §e{0} §7wurde geladen +SIMULATOR_REMOVE = §7Simulator §e{0} §7wurde gelöscht +SIMULATOR_LIST_NOTHING = §7Keine gespeicherten Simulatoren +SIMULATOR_LIST_HEADER = §7Gespeicherte Simulatoren: +SIMULATOR_LIST_ELEMENT = §e{0} §8[§7Laden§8] +SIMULATOR_LIST_ELEMENT_HOVER = §eZum laden klicken + +SIMULATOR_WAND_NAME = §eKanonensimulator +SIMULATOR_WAND_LORE_1 = §eRechtsklick §8- §7Füge eine Position hinzu +SIMULATOR_WAND_LORE_2 = §eSneaken §8- §7Freie Bewegung +SIMULATOR_WAND_LORE_3 = §eLinksklick §8- §7Starte die Simulation +SIMULATOR_WAND_LORE_4 = §eRechtsklick Luft §8- §7Öffne die GUI + +## Other +SIMULATOR_PLUS_ONE = §7+1 +SIMULATOR_PLUS_PIXEL_SHIFT = §eShift §7Click für §e+0,0625 +SIMULATOR_PLUS_FIVE_SHIFT = §eShift §7Click für §e+5 +SIMULATOR_MINUS_ONE = §7-1 +SIMULATOR_MINUS_PIXEL_SHIFT = §eShift §7Click für §e-0,0625 +SIMULATOR_MINUS_FIVE_SHIFT = §eShift §7Click für §e-5 +SIMULATOR_POSITION_X = §7x-Position +SIMULATOR_POSITION_Y = §7y-Position +SIMULATOR_POSITION_Z = §7z-Position +SIMULATOR_BACK = §eZurück + +## GUI +SIMULATOR_POSITION_EDIT = §ePosition bearbeiten +SIMULATOR_POSITION_ADD = §ePosition setzen +SIMULATOR_GUI_TNT_SPAWN_NAME = §eTNT +SIMULATOR_GUI_TNT_SPAWN_LORE_1 = §7TNT-Anzahl§8: §e{0} +SIMULATOR_GUI_TNT_SPAWN_LORE_2 = §7Tick§8: §e{0} +SIMULATOR_GUI_TNT_SPAWN_LORE_3 = §7 +SIMULATOR_GUI_TNT_SPAWN_LORE_4 = §7x§8: §e{0} +SIMULATOR_GUI_TNT_SPAWN_LORE_5 = §7y§8: §e{0} +SIMULATOR_GUI_TNT_SPAWN_LORE_6 = §7z§8: §e{0} +SIMULATOR_GUI_NAME = Kanonensimulator +SIMULATOR_GUI_DELETE = §cTNT löschen +SIMULATOR_GUI_START = §eStarten +SIMULATOR_GUI_AUTO_TRACE = §eAutoTrace§8: §7{0} +SIMULATOR_GUI_MOVE_ALL = §eAlle Verschieben + +SIMULATOR_MOVE_ALL_GUI_NAME = TNT Verschieben + +SIMULATOR_TNT_SPAWN_GUI_NAME = TNT konfigurieren +SIMULATOR_TNT_SPAWN_LORE = §eZum Ändern klicken +SIMULATOR_TNT_SPAWN_COUNT = §7TNT-Anzahl §8- §e{0} +SIMULATOR_TNT_SPAWN_COUNT_ANVIL_GUI_NAME = Anzahl TNT +SIMULATOR_TNT_SPAWN_TICK = §7Tick §8- §e{0} +SIMULATOR_TNT_SPAWN_TICK_ANVIL_GUI_NAME = Tick Offset +SIMULATOR_TNT_SPAWN_FUSE = §7Lebensdauer §8- §e{0} +SIMULATOR_TNT_SPAWN_FUSE_ANVIL_GUI_NAME = Fuse-Ticks +SIMULATOR_TNT_SPAWN_VELOCITY_NAME = §7TNT +SIMULATOR_TNT_SPAWN_VELOCITY_X = §7TNT §eSprung X §8- {0} +SIMULATOR_TNT_SPAWN_VELOCITY_Y = §7TNT §eSprung Y §8- {0} +SIMULATOR_TNT_SPAWN_VELOCITY_Z = §7TNT §eSprung Z §8- {0} +SIMULATOR_TNT_SPAWN_VELOCITY_ON = §aan +SIMULATOR_TNT_SPAWN_VELOCITY_OFF = §caus +SIMULATOR_TNT_SPAWN_POSITION_X = §7x-Position §8- §e{0} +SIMULATOR_TNT_SPAWN_POSITION_Y = §7y-Position §8- §e{0} +SIMULATOR_TNT_SPAWN_POSITION_Z = §7z-Position §8- §e{0} +SIMULATOR_TNT_SPAWN_ACTIVATED_WITH = §7Gezündet durch §8- §e{0} +SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_COMPARATOR = Comparator +SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_REPEATER = Repeater +SIMULATOR_TNT_SPAWN_ADD_IGNITION_PHASE = §eZündphase hinzufügen +SIMULATOR_TNT_SPAWN_ADD_TNT = §eTNT hinzufügen +SIMULATOR_TNT_SPAWN_REMOVE_TNT = §cEntfernen +SIMULATOR_TNT_SPAWN_POSITION_ANVIL_GUI_NAME = Position # SmartPlace SMART_PLACE_HELP = §8/§esmartplace §8-§7 Toggled SmartPlace diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCommand.java index cdcaec09..2291ee42 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCommand.java @@ -23,12 +23,15 @@ package de.steamwar.bausystem.features.simulator; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.SWUtils; -import de.steamwar.bausystem.config.ColorConfig; import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.bausystem.utils.ListChatView; import de.steamwar.bausystem.worlddata.SimulatorData; -import de.steamwar.command.SWCommand; -import de.steamwar.command.TypeMapper; +import de.steamwar.command.*; +import net.md_5.bungee.api.chat.ClickEvent; +import net.md_5.bungee.api.chat.ComponentBuilder; +import net.md_5.bungee.api.chat.HoverEvent; +import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -41,86 +44,82 @@ public class SimulatorCommand extends SWCommand { super("simulator", "sim"); } - @Register(help = true) - public void genericHelp(Player p, String... args) { - p.sendMessage(ColorConfig.OTHER + "/" + ColorConfig.HIGHLIGHT + "simulator" + ColorConfig.OTHER + " - " + ColorConfig.BASE + "Legt dir den Simulatorstab ins Inventar"); - p.sendMessage(ColorConfig.OTHER + "/" + ColorConfig.HIGHLIGHT + "simulator start" + ColorConfig.OTHER + " - " + ColorConfig.BASE + "Startet die Simulation"); - p.sendMessage(ColorConfig.OTHER + "/" + ColorConfig.HIGHLIGHT + "simulator gui" + ColorConfig.OTHER + " - " + ColorConfig.BASE + "Öffnet die GUI"); - p.sendMessage(ColorConfig.OTHER + "/" + ColorConfig.HIGHLIGHT + "simulator delete" + ColorConfig.OTHER + " - " + ColorConfig.BASE + "Löscht alle TNT"); - p.sendMessage(ColorConfig.OTHER + "/" + ColorConfig.HIGHLIGHT + "simulator save " + ColorConfig.OTHER + " - " + ColorConfig.BASE + "Speichert den Simulator"); - p.sendMessage(ColorConfig.OTHER + "/" + ColorConfig.HIGHLIGHT + "simulator load " + ColorConfig.OTHER + " - " + ColorConfig.BASE + "Lädt den Simulator"); - p.sendMessage(ColorConfig.OTHER + "/" + ColorConfig.HIGHLIGHT + "simulator list" + ColorConfig.OTHER + " - " + ColorConfig.BASE + "Listet alle gespeicherten Simulator"); - p.sendMessage(ColorConfig.OTHER + "/" + ColorConfig.HIGHLIGHT + "simulator remove " + ColorConfig.OTHER + " - " + ColorConfig.BASE + "Löscht den Simulator"); + @Register(description = "SIMULATOR_HELP") + public void genericCommand(@Guard Player p) { + SWUtils.giveItemToPlayer(p, TNTSimulator.getWand(p)); } - @Register - public void genericCommand(Player p) { - if (cannotUse(p)) return; - SWUtils.giveItemToPlayer(p, TNTSimulator.WAND); - } - - @Register({"start"}) - public void startCommand(Player p) { - if (cannotUse(p)) return; + @Register(value = {"start"}, description = "SIMULATOR_START_HELP") + public void startCommand(@Guard Player p) { TNTSimulator.get(p).start(); } - @Register({"gui"}) - public void guiCommand(Player p) { - if (cannotUse(p)) return; + @Register(value = {"gui"}, description = "SIMULATOR_GUI_HELP") + public void guiCommand(@Guard Player p) { TNTSimulator.get(p).showGUI(); } - @Register({"delete"}) - public void deleteCommand(Player p) { - if (cannotUse(p)) return; + @Register(value = {"delete"}, description = "SIMULATOR_DELETE_HELP") + public void deleteCommand(@Guard Player p) { TNTSimulator.get(p).delete(); - p.sendMessage(ColorConfig.BASE + "Alle TNT wurden gelöscht"); + BauSystem.MESSAGE.send("SIMULATOR_DELETE_TNT", p); } - @Register({"save"}) - public void saveCommand(Player p, String name) { - if (cannotUse(p)) return; + @Register(value = {"save"}, description = "SIMULATOR_SAVE_HELP") + public void saveCommand(@Guard Player p, String name) { TNTSimulator.get(p).save(); SimulatorData.saveSimulator(p, name); - p.sendMessage(ColorConfig.BASE + "Simulator " + ColorConfig.HIGHLIGHT + name + ColorConfig.BASE + " wurde gespeichert"); + BauSystem.MESSAGE.send("SIMULATOR_SAVE", p, name); } - @Register({"load"}) - public void loadCommand(Player p, @Mapper("SavedSimulators") String name) { - if (cannotUse(p)) return; + @Register(value = {"load"}, description = "SIMULATOR_LOAD_HELP") + public void loadCommand(@Guard Player p, @Mapper("SavedSimulators") String name) { TNTSimulator.get(p).delete(); SimulatorData.loadSimulator(p, name); - p.sendMessage(ColorConfig.BASE + "Simulator " + ColorConfig.HIGHLIGHT + name + ColorConfig.BASE + " wurde geladen"); + BauSystem.MESSAGE.send("SIMULATOR_LOAD", p, name); } - @Register({"remove"}) - public void removeCommand(Player p, @Mapper("SavedSimulators") String name) { - if (cannotUse(p)) return; + @Register(value = {"remove"}, description = "SIMULATOR_REMOVE_HELP") + public void removeCommand(@Guard Player p, @Mapper("SavedSimulators") String name) { SimulatorData.removeSimulator(p, name); - p.sendMessage(ColorConfig.BASE + "Simulator " + ColorConfig.HIGHLIGHT + name + ColorConfig.BASE + " wurde gelöscht"); + BauSystem.MESSAGE.send("SIMULATOR_REMOVE", p, name); } - @Register({"list"}) - public void listCommand(Player p) { - if (cannotUse(p)) return; + @Register(value = {"list"}, description = "SIMULATOR_LIST_HELP") + public void listCommand(@Guard Player p, @OptionalValue("0") int page) { List sims = SimulatorData.listSimulator(p); if (sims.isEmpty()) { - p.sendMessage(ColorConfig.BASE + "Keine gespeicherten Simulatoren"); + BauSystem.MESSAGE.send("SIMULATOR_LIST_NOTHING", p); return; } - p.sendMessage(ColorConfig.BASE + "Gespeicherte Simulatoren:"); - for (String s : sims) { - p.sendMessage(ColorConfig.OTHER + "/" + ColorConfig.HIGHLIGHT + "simulator load " + s); - } + BauSystem.MESSAGE.send("SIMULATOR_LIST_HEADER", p); + ListChatView.chatView(p, sims, page, simulator -> { + TextComponent component = new TextComponent(); + component.setText(BauSystem.MESSAGE.parse("SIMULATOR_LIST_ELEMENT", p, simulator)); + component.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/simulator load " + simulator)); + component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(BauSystem.MESSAGE.parse("SIMULATOR_LIST_ELEMENT_HOVER", p)))); + return component; + }, (beforePageComponent, beforePage) -> { + beforePageComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(BauSystem.MESSAGE.parse("LIST_PREVIOUS_PAGE", p)).create())); + beforePageComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/simulator list " + beforePage)); + }, (afterPageComponent, afterPage) -> { + afterPageComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(BauSystem.MESSAGE.parse("LIST_NEXT_PAGE", p)).create())); + afterPageComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/simulator list " + afterPage)); + }); } - private boolean cannotUse(Player player) { - if (!Permission.hasPermission(player, Permission.WORLD)) { - player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Simulator nutzen"); - return true; - } - return false; + @ClassGuard(value = Player.class, local = true) + public GuardChecker guardChecker() { + return (commandSender, guardCheckType, strings, s) -> { + Player player = (Player) commandSender; + if (Permission.hasPermission(player, Permission.WORLD)) { + return GuardResult.ALLOWED; + } + if (guardCheckType != GuardCheckType.TAB_COMPLETE) { + BauSystem.MESSAGE.send("SIMULATOR_NO_PERMS", player); + } + return GuardResult.DENIED; + }; } @Mapper(value = "SavedSimulators", local = true) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulator.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulator.java index 1907dee0..6cddec56 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulator.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulator.java @@ -22,16 +22,16 @@ package de.steamwar.bausystem.features.simulator; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.SWUtils; -import de.steamwar.bausystem.config.ColorConfig; import de.steamwar.bausystem.configplayer.Config; import de.steamwar.bausystem.features.simulator.show.SimulatorEntityShowMode; import de.steamwar.bausystem.features.tracer.record.RecordStateMachine; +import de.steamwar.bausystem.utils.ItemUtils; import de.steamwar.bausystem.worlddata.SimulatorData; import de.steamwar.inventory.SWAnvilInv; import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWListInv; +import net.md_5.bungee.api.ChatMessageType; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.World; @@ -61,9 +61,13 @@ public class TNTSimulator { private static final Vector FZ_VECTOR = new Vector(0, 0, 1); private static final World WORLD = Bukkit.getWorlds().get(0); - private static final List LORE = Collections.singletonList("§eZum Ändern klicken"); private static final List EMPTY = new ArrayList<>(); - public static final ItemStack WAND = new SWItem(Material.BLAZE_ROD, "§eKanonensimulator", Arrays.asList("§eRechtsklick §8- §7Füge eine Position hinzu", "§eSneaken §8- §7Auf den Block zentrieren", "§eLinksklick §8- §7Starte die Simulation", "§eRechtsklick Luft §8- §7Öffne die GUI"), false, null).getItemStack(); + + public static ItemStack getWand(Player p) { + ItemStack itemStack = new SWItem(Material.BLAZE_ROD, BauSystem.MESSAGE.parse("SIMULATOR_WAND_NAME", p), Arrays.asList(BauSystem.MESSAGE.parse("SIMULATOR_WAND_LORE_1", p), BauSystem.MESSAGE.parse("SIMULATOR_WAND_LORE_2", p), BauSystem.MESSAGE.parse("SIMULATOR_WAND_LORE_3", p), BauSystem.MESSAGE.parse("SIMULATOR_WAND_LORE_4", p)), false, null).getItemStack(); + ItemUtils.setItem(itemStack, "simulator"); + return itemStack; + } static final Map TNT_SIMULATOR_MAP = new HashMap<>(); @@ -132,13 +136,13 @@ public class TNTSimulator { cursor = SimulatorEntityShowMode.createEntity(player, tntSpawns.isEmpty() ? getPos(result) : tntSpawns.get(0).position, true); cursor.display(player); - SWUtils.sendToActionbar(player, ColorConfig.HIGHLIGHT + "Position bearbeiten"); + BauSystem.MESSAGE.send("SIMULATOR_POSITION_EDIT", player, ChatMessageType.ACTION_BAR); return; } cursor = SimulatorEntityShowMode.createEntity(player, getPos(result), false); cursor.display(player); - SWUtils.sendToActionbar(player, ColorConfig.HIGHLIGHT + "Position setzen"); + BauSystem.MESSAGE.send("SIMULATOR_POSITION_ADD", player, ChatMessageType.ACTION_BAR); } public void edit(RayTraceResult result) { @@ -215,80 +219,85 @@ public class TNTSimulator { public void showGUI(Set tntSpawns) { List> swListEntryList = tntSpawns.stream().map(spawn -> { List lore = new ArrayList<>(); - lore.add("§7TNT-Anzahl§8: §e" + spawn.count); - lore.add("§7Tick§8: §e" + spawn.tickOffset); - lore.add(""); - lore.add("§7x§8: §e" + spawn.position.getX()); - lore.add("§7y§8: §e" + spawn.position.getY()); - lore.add("§7z§8: §e" + spawn.position.getZ()); - SWItem swItem = new SWItem(Material.TNT, "§eTNT", lore, false, null); + lore.add(BauSystem.MESSAGE.parse("SIMULATOR_GUI_TNT_SPAWN_LORE_1", player, spawn.count)); + lore.add(BauSystem.MESSAGE.parse("SIMULATOR_GUI_TNT_SPAWN_LORE_2", player, spawn.getTickOffset())); + lore.add(BauSystem.MESSAGE.parse("SIMULATOR_GUI_TNT_SPAWN_LORE_3", player)); + lore.add(BauSystem.MESSAGE.parse("SIMULATOR_GUI_TNT_SPAWN_LORE_4", player, spawn.position.getX())); + lore.add(BauSystem.MESSAGE.parse("SIMULATOR_GUI_TNT_SPAWN_LORE_5", player, spawn.position.getY())); + lore.add(BauSystem.MESSAGE.parse("SIMULATOR_GUI_TNT_SPAWN_LORE_6", player, spawn.position.getZ())); + SWItem swItem = new SWItem(Material.TNT, BauSystem.MESSAGE.parse("SIMULATOR_GUI_TNT_SPAWN_NAME", player), lore, false, null); swItem.getItemStack().setAmount(spawn.count); return new SWListInv.SWListEntry<>(swItem, spawn); }).sorted(Comparator.comparing(SWListInv.SWListEntry::getObject)).collect(Collectors.toList()); - SWListInv swListInv = new SWListInv<>(player, "Kanonensimulator", false, swListEntryList, (clickType, spawn) -> { + SWListInv swListInv = new SWListInv<>(player, BauSystem.MESSAGE.parse("SIMULATOR_GUI_NAME", player), false, swListEntryList, (clickType, spawn) -> { spawn.editTNT(tntSpawns); }); - swListInv.setItem(51, new SWItem(Material.BARRIER, "§cTNT löschen", clickType -> { + swListInv.setItem(51, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("SIMULATOR_GUI_DELETE", player), clickType -> { delete(); player.closeInventory(); })); - swListInv.setItem(47, new SWItem(Material.FLINT_AND_STEEL, "§eStarten", clickType -> { + swListInv.setItem(47, new SWItem(Material.FLINT_AND_STEEL, BauSystem.MESSAGE.parse("SIMULATOR_GUI_START", player), clickType -> { start(); player.closeInventory(); })); boolean simulatorAutoTrace = Config.getInstance().get(player).getPlainValueOrDefault("simulatorAutoTrace", false); - swListInv.setItem(48, new SWItem(simulatorAutoTrace ? Material.CHAIN_COMMAND_BLOCK : Material.COMMAND_BLOCK, "§eAutoTrace§8: §7" + simulatorAutoTrace, clickType -> { + swListInv.setItem(48, new SWItem(simulatorAutoTrace ? Material.CHAIN_COMMAND_BLOCK : Material.COMMAND_BLOCK, BauSystem.MESSAGE.parse("SIMULATOR_GUI_AUTO_TRACE", player, simulatorAutoTrace), clickType -> { Config.getInstance().get(player).put("simulatorAutoTrace", !simulatorAutoTrace); showGUI(tntSpawns); })); - swListInv.setItem(49, new SWItem(Material.MAGENTA_GLAZED_TERRACOTTA, "§eAlle Verschieben", clickType -> { + swListInv.setItem(49, new SWItem(Material.MAGENTA_GLAZED_TERRACOTTA, BauSystem.MESSAGE.parse("SIMULATOR_GUI_MOVE_ALL", player), clickType -> { move(tntSpawns); })); swListInv.open(); } private void move(Set tntSpawns) { - SWInventory swInventory = new SWInventory(player, 54, "TNT Verschieben"); + SWInventory swInventory = new SWInventory(player, 54, BauSystem.MESSAGE.parse("SIMULATOR_MOVE_ALL_GUI_NAME", player)); + + String plusOneName = BauSystem.MESSAGE.parse("SIMULATOR_PLUS_ONE", player); + String minusOneName = BauSystem.MESSAGE.parse("SIMULATOR_MINUS_ONE", player); + List plusOnePixelShiftLore = Arrays.asList(BauSystem.MESSAGE.parse("SIMULATOR_PLUS_PIXEL_SHIFT", player)); + List minusOnePixelShiftLore = Arrays.asList(BauSystem.MESSAGE.parse("SIMULATOR_MINUS_PIXEL_SHIFT", player)); // Position Settings // X Position - swInventory.setItem(12, new SWItem(SWItem.getDye(10), "§7+1", Arrays.asList("§eShift §7Click für §e+0,0625"), false, clickType -> { + swInventory.setItem(12, new SWItem(SWItem.getDye(10), plusOneName, plusOnePixelShiftLore, false, clickType -> { updatePosition(tntSpawns, vector -> vector.add(clickType.isShiftClick() ? X_VECTOR : FX_VECTOR)); move(tntSpawns); })); - swInventory.setItem(21, new SWItem(Material.PAPER, "§7x-Position", clickType -> { + swInventory.setItem(21, new SWItem(Material.PAPER, BauSystem.MESSAGE.parse("SIMULATOR_POSITION_X", player), clickType -> { })); - swInventory.setItem(30, new SWItem(SWItem.getDye(1), "§7-1", Arrays.asList("§eShift §7Click für §e-0,0625"), false, clickType -> { + swInventory.setItem(30, new SWItem(SWItem.getDye(1), minusOneName, minusOnePixelShiftLore, false, clickType -> { updatePosition(tntSpawns, vector -> vector.subtract(clickType.isShiftClick() ? X_VECTOR : FX_VECTOR)); move(tntSpawns); })); // Y Position - swInventory.setItem(13, new SWItem(SWItem.getDye(10), "§7+1", Arrays.asList("§eShift §7Click für §e+0,0625"), false, clickType -> { + swInventory.setItem(13, new SWItem(SWItem.getDye(10), plusOneName, plusOnePixelShiftLore, false, clickType -> { updatePosition(tntSpawns, vector -> vector.add(clickType.isShiftClick() ? Y_VECTOR : FY_VECTOR)); move(tntSpawns); })); - swInventory.setItem(22, new SWItem(Material.PAPER, "§7y-Position", clickType -> { + swInventory.setItem(22, new SWItem(Material.PAPER, BauSystem.MESSAGE.parse("SIMULATOR_POSITION_Y", player), clickType -> { })); - swInventory.setItem(31, new SWItem(SWItem.getDye(1), "§7-1", Arrays.asList("§eShift §7Click für §e-0,0625"), false, clickType -> { + swInventory.setItem(31, new SWItem(SWItem.getDye(1), minusOneName, minusOnePixelShiftLore, false, clickType -> { updatePosition(tntSpawns, vector -> vector.subtract(clickType.isShiftClick() ? Y_VECTOR : FY_VECTOR)); move(tntSpawns); })); // Z Position - swInventory.setItem(14, new SWItem(SWItem.getDye(10), "§7+1", Arrays.asList("§eShift §7Click für §e+0,0625"), false, clickType -> { + swInventory.setItem(14, new SWItem(SWItem.getDye(10), plusOneName, plusOnePixelShiftLore, false, clickType -> { updatePosition(tntSpawns, vector -> vector.add(clickType.isShiftClick() ? Z_VECTOR : FZ_VECTOR)); move(tntSpawns); })); - swInventory.setItem(23, new SWItem(Material.PAPER, "§7z-Position", clickType -> { + swInventory.setItem(23, new SWItem(Material.PAPER, BauSystem.MESSAGE.parse("SIMULATOR_POSITION_Z", player), clickType -> { })); - swInventory.setItem(32, new SWItem(SWItem.getDye(1), "§7-1", Arrays.asList("§eShift §7Click für §e-0,0625"), false, clickType -> { + swInventory.setItem(32, new SWItem(SWItem.getDye(1), minusOneName, minusOnePixelShiftLore, false, clickType -> { updatePosition(tntSpawns, vector -> vector.subtract(clickType.isShiftClick() ? Z_VECTOR : FZ_VECTOR)); move(tntSpawns); })); - swInventory.setItem(53, new SWItem(Material.ARROW, "§eZurück", clickType -> { + swInventory.setItem(53, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("SIMULATOR_BACK", player), clickType -> { showGUI(tntSpawns); })); swInventory.open(); @@ -362,7 +371,7 @@ public class TNTSimulator { break; } - if (face.getModY() == 0 && !player.isSneaking()) { + if (face.getModY() == 0 && player.isSneaking()) { pos.setY(pos.getY() - 0.49); } } @@ -479,58 +488,66 @@ public class TNTSimulator { hide(); entity.setPosition(position); show(); - SWInventory swInventory = new SWInventory(player, 54, "TNT konfigurieren"); + SWInventory swInventory = new SWInventory(player, 54, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_GUI_NAME", player)); + + String plusOneName = BauSystem.MESSAGE.parse("SIMULATOR_PLUS_ONE", player); + String minusOneName = BauSystem.MESSAGE.parse("SIMULATOR_MINUS_ONE", player); + List plusOnePixelShiftLore = Arrays.asList(BauSystem.MESSAGE.parse("SIMULATOR_PLUS_PIXEL_SHIFT", player)); + List minusOnePixelShiftLore = Arrays.asList(BauSystem.MESSAGE.parse("SIMULATOR_MINUS_PIXEL_SHIFT", player)); + List plusOneFiveShiftLore = Arrays.asList(BauSystem.MESSAGE.parse("SIMULATOR_PLUS_FIVE_SHIFT", player)); + List minusOneFiveShiftLore = Arrays.asList(BauSystem.MESSAGE.parse("SIMULATOR_MINUS_FIVE_SHIFT", player)); + List lore = Arrays.asList(BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_LORE", player)); // Change Count of spawned TNT - swInventory.setItem(1, new SWItem(SWItem.getDye(10), "§7+1", Arrays.asList("§eShift §7Click für §e+5"), false, clickType -> { + swInventory.setItem(1, new SWItem(SWItem.getDye(10), plusOneName, plusOneFiveShiftLore, false, clickType -> { setCount(count + (clickType.isShiftClick() ? 5 : 1)); editTNT(tntSpawns); })); - SWItem countItem = new SWItem(Material.TNT, "§7TNT-Anzahl §8- §e" + count, LORE, false, clickType -> changeCount(player, "Anzahl TNT", count, c -> { + SWItem countItem = new SWItem(Material.TNT, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_COUNT", player, count), lore, false, clickType -> changeCount(player, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_COUNT_ANVIL_GUI_NAME", player), count, c -> { setCount(c); editTNT(tntSpawns); }, () -> editTNT(tntSpawns))); countItem.getItemStack().setAmount(count); swInventory.setItem(10, countItem); - swInventory.setItem(19, new SWItem(SWItem.getDye(1), "§7-1", Arrays.asList("§eShift §7Click für §e-5"), false, clickType -> { + swInventory.setItem(19, new SWItem(SWItem.getDye(1), minusOneName, minusOneFiveShiftLore, false, clickType -> { setCount(count - (clickType.isShiftClick() ? 5 : 1)); editTNT(tntSpawns); })); // Change TickOffset - swInventory.setItem(2, new SWItem(SWItem.getDye(10), "§7+1", Arrays.asList("§eShift §7Click für §e+5"), false, clickType -> { + swInventory.setItem(2, new SWItem(SWItem.getDye(10), plusOneName, plusOneFiveShiftLore, false, clickType -> { setTickOffset(tickOffset + (clickType.isShiftClick() ? 5 : 1)); editTNT(tntSpawns); })); - SWItem tickItem = new SWItem(SWItem.getMaterial("DIODE"), "§7Tick §8- §e" + tickOffset, LORE, false, clickType -> changeCount(player, "Tick Offset", tickOffset, tick -> { + SWItem tickItem = new SWItem(SWItem.getMaterial("DIODE"), BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_TICK", player, tickOffset), lore, false, clickType -> changeCount(player, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_TICK_ANVIL_GUI_NAME", player), tickOffset, tick -> { setTickOffset(tick); editTNT(tntSpawns); }, () -> editTNT(tntSpawns))); tickItem.getItemStack().setAmount(Math.max(tickOffset, 1)); swInventory.setItem(11, tickItem); - swInventory.setItem(20, new SWItem(SWItem.getDye(1), "§7-1", Arrays.asList("§eShift §7Click für §e-5"), false, clickType -> { + swInventory.setItem(20, new SWItem(SWItem.getDye(1), minusOneName, minusOneFiveShiftLore, false, clickType -> { setTickOffset(tickOffset - (clickType.isShiftClick() ? 5 : 1)); editTNT(tntSpawns); })); // Change FuseTicks - swInventory.setItem(3, new SWItem(SWItem.getDye(10), "§7+1", Arrays.asList("§eShift §7Click für §e+5"), false, clickType -> { + swInventory.setItem(3, new SWItem(SWItem.getDye(10), plusOneName, plusOneFiveShiftLore, false, clickType -> { setFuseTicks(fuseTicks + (clickType.isShiftClick() ? 5 : 1)); editTNT(tntSpawns); })); - SWItem fuseTickItem = new SWItem(Material.CLOCK, "§7Lebensdauer §8- §e" + fuseTicks, LORE, false, clickType -> changeCount(player, "Fuse-Ticks", fuseTicks, tick -> { + SWItem fuseTickItem = new SWItem(Material.CLOCK, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_FUSE", player, fuseTicks), lore, false, clickType -> changeCount(player, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_FUSE_ANVIL_GUI_NAME", player), fuseTicks, tick -> { setFuseTicks(tick); editTNT(tntSpawns); }, () -> editTNT(tntSpawns))); fuseTickItem.getItemStack().setAmount(Math.max(fuseTicks, 1)); swInventory.setItem(12, fuseTickItem); - swInventory.setItem(21, new SWItem(SWItem.getDye(1), "§7-1", Arrays.asList("§eShift §7Click für §e-5"), false, clickType -> { + swInventory.setItem(21, new SWItem(SWItem.getDye(1), minusOneName, minusOneFiveShiftLore, false, clickType -> { setFuseTicks(fuseTicks - (clickType.isShiftClick() ? 5 : 1)); editTNT(tntSpawns); })); // Velocity Settings - swInventory.setItem(38, Material.TNT, "§7TNT", clickType -> { + swInventory.setItem(38, Material.TNT, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_VELOCITY_NAME", player), clickType -> { if (xVelocity || yVelocity || zVelocity) { xVelocity = false; yVelocity = false; @@ -542,89 +559,89 @@ public class TNTSimulator { } editTNT(tntSpawns); }); - swInventory.setItem(46, new SWItem(getWool(xVelocity), getColor(xVelocity), "§7TNT §eSprung X §8- " + active(xVelocity), clickType -> { + swInventory.setItem(46, new SWItem(getWool(xVelocity), getColor(xVelocity), BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_VELOCITY_X", player, BauSystem.MESSAGE.parse(active(xVelocity), player)), clickType -> { xVelocity = !xVelocity; editTNT(tntSpawns); })); - swInventory.setItem(29, new SWItem(getWool(yVelocity), getColor(yVelocity), "§7TNT §eSprung Y §8- " + active(yVelocity), clickType -> { + swInventory.setItem(29, new SWItem(getWool(yVelocity), getColor(yVelocity), BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_VELOCITY_Y", player, BauSystem.MESSAGE.parse(active(yVelocity), player)), clickType -> { yVelocity = !yVelocity; editTNT(tntSpawns); })); - swInventory.setItem(48, new SWItem(getWool(zVelocity), getColor(zVelocity), "§7TNT §eSprung Z §8- " + active(zVelocity), clickType -> { + swInventory.setItem(48, new SWItem(getWool(zVelocity), getColor(zVelocity), BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_VELOCITY_Z", player, BauSystem.MESSAGE.parse(active(zVelocity), player)), clickType -> { zVelocity = !zVelocity; editTNT(tntSpawns); })); // Position Settings // X Position - swInventory.setItem(5, new SWItem(SWItem.getDye(10), "§7+1", Arrays.asList("§eShift §7Click für §e+0,0625"), false, clickType -> { + swInventory.setItem(5, new SWItem(SWItem.getDye(10), plusOneName, plusOnePixelShiftLore, false, clickType -> { position.add(clickType.isShiftClick() ? X_VECTOR : FX_VECTOR); editTNT(tntSpawns); })); - swInventory.setItem(14, new SWItem(Material.PAPER, "§7x-Position §8- §e" + position.getX(), LORE, false, clickType -> { + swInventory.setItem(14, new SWItem(Material.PAPER, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_POSITION_X", player, position.getX()), lore, false, clickType -> { changePosition(player, position.getX(), x -> { position.setX(clamp(x)); editTNT(tntSpawns); }, () -> editTNT(tntSpawns)); })); - swInventory.setItem(23, new SWItem(SWItem.getDye(1), "§7-1", Arrays.asList("§eShift §7Click für §e-0,0625"), false, clickType -> { + swInventory.setItem(23, new SWItem(SWItem.getDye(1), minusOneName, minusOnePixelShiftLore, false, clickType -> { position.subtract(clickType.isShiftClick() ? X_VECTOR : FX_VECTOR); editTNT(tntSpawns); })); // Y Position - swInventory.setItem(6, new SWItem(SWItem.getDye(10), "§7+1", Arrays.asList("§eShift §7Click für §e+0,0625"), false, clickType -> { + swInventory.setItem(6, new SWItem(SWItem.getDye(10), plusOneName, plusOnePixelShiftLore, false, clickType -> { position.add(clickType.isShiftClick() ? Y_VECTOR : FY_VECTOR); editTNT(tntSpawns); })); - swInventory.setItem(15, new SWItem(Material.PAPER, "§7y-Position §8- §e" + position.getY(), LORE, false, clickType -> { + swInventory.setItem(15, new SWItem(Material.PAPER, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_POSITION_Y", player, position.getY()), lore, false, clickType -> { changePosition(player, position.getY(), y -> { position.setY(clamp(y)); editTNT(tntSpawns); }, () -> editTNT(tntSpawns)); })); - swInventory.setItem(24, new SWItem(SWItem.getDye(1), "§7-1", Arrays.asList("§eShift §7Click für §e-0,0625"), false, clickType -> { + swInventory.setItem(24, new SWItem(SWItem.getDye(1), minusOneName, minusOnePixelShiftLore, false, clickType -> { position.subtract(clickType.isShiftClick() ? Y_VECTOR : FY_VECTOR); editTNT(tntSpawns); })); // Z Position - swInventory.setItem(7, new SWItem(SWItem.getDye(10), "§7+1", Arrays.asList("§eShift §7Click für §e+0,0625"), false, clickType -> { + swInventory.setItem(7, new SWItem(SWItem.getDye(10), plusOneName, plusOnePixelShiftLore, false, clickType -> { position.add(clickType.isShiftClick() ? Z_VECTOR : FZ_VECTOR); editTNT(tntSpawns); })); - swInventory.setItem(16, new SWItem(Material.PAPER, "§7z-Position §8- §e" + position.getZ(), LORE, false, clickType -> { + swInventory.setItem(16, new SWItem(Material.PAPER, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_POSITION_Z", player, position.getZ()), lore, false, clickType -> { changePosition(player, position.getZ(), z -> { position.setZ(clamp(z)); editTNT(tntSpawns); }, () -> editTNT(tntSpawns)); })); - swInventory.setItem(25, new SWItem(SWItem.getDye(1), "§7-1", Arrays.asList("§eShift §7Click für §e-0,0625"), false, clickType -> { + swInventory.setItem(25, new SWItem(SWItem.getDye(1), minusOneName, minusOnePixelShiftLore, false, clickType -> { position.subtract(clickType.isShiftClick() ? Z_VECTOR : FZ_VECTOR); editTNT(tntSpawns); })); // Repeater before Comparator - swInventory.setItem(42, new SWItem(comparator ? SWItem.getMaterial("REDSTONE_COMPARATOR_OFF") : SWItem.getMaterial("DIODE"), "§7Gezündet durch §8- §e" + (comparator ? "Comparator" : "Repeater"), clickType -> { + swInventory.setItem(42, new SWItem(comparator ? SWItem.getMaterial("REDSTONE_COMPARATOR_OFF") : SWItem.getMaterial("DIODE"), BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_ACTIVATED_WITH", player, BauSystem.MESSAGE.parse(comparator ? "SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_COMPARATOR" : "SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_REPEATER", player)), clickType -> { comparator = !comparator; editTNT(tntSpawns); })); - swInventory.setItem(33, new SWItem(Material.TNT, "§eZündphase hinzufügen", clickType -> { + swInventory.setItem(33, new SWItem(Material.TNT, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_ADD_IGNITION_PHASE", player), clickType -> { spawns.add(new TNTSpawn(position, entity)); })); - swInventory.setItem(53, new SWItem(Material.ARROW, "§eZurück", clickType -> { + swInventory.setItem(53, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("SIMULATOR_BACK", player), clickType -> { showGUI(tntSpawns); })); - swInventory.setItem(51, new SWItem(Material.DISPENSER, "§eTNT hinzufügen", clickType -> { + swInventory.setItem(51, new SWItem(Material.DISPENSER, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_ADD_TNT", player), clickType -> { Vector vector = position.clone(); spawns.add(new TNTSpawn(vector, SimulatorEntityShowMode.createEntity(player, vector, false))); })); // Delete tnt - swInventory.setItem(44, new SWItem(Material.BARRIER, "§cEntfernen", clickType -> { + swInventory.setItem(44, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_REMOVE_TNT", player), clickType -> { hide(); spawns.remove(this); player.closeInventory(); @@ -650,7 +667,7 @@ public class TNTSimulator { } private void changePosition(Player player, double defaultValue, Consumer result, Runnable failure) { - SWAnvilInv swAnvilInv = new SWAnvilInv(player, "Position", defaultValue + ""); + SWAnvilInv swAnvilInv = new SWAnvilInv(player, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_POSITION_ANVIL_GUI_NAME", player), defaultValue + ""); swAnvilInv.setItem(Material.PAPER); swAnvilInv.setCallback(s -> { try { @@ -675,7 +692,7 @@ public class TNTSimulator { } private String active(boolean b) { - return b ? "§aan" : "§caus"; + return b ? "SIMULATOR_TNT_SPAWN_VELOCITY_ON" : "SIMULATOR_TNT_SPAWN_VELOCITY_OFF"; } } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulatorListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulatorListener.java index 4e0359df..8bbb3711 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulatorListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulatorListener.java @@ -26,6 +26,7 @@ import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.linkage.Disable; import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.bausystem.utils.ItemUtils; import org.bukkit.FluidCollisionMode; import org.bukkit.Location; import org.bukkit.entity.Entity; @@ -44,7 +45,6 @@ import org.bukkit.util.Vector; import java.util.function.Function; -import static de.steamwar.bausystem.features.simulator.TNTSimulator.WAND; import static de.steamwar.bausystem.features.simulator.TNTSimulator.get; @Linked(LinkageType.LISTENER) @@ -53,7 +53,7 @@ public class TNTSimulatorListener implements Listener, Disable { private boolean permissionCheck(Player player) { if (!Permission.hasPermission(player, Permission.WORLD)) { - player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Simulator nutzen"); + BauSystem.MESSAGE.send("SIMULATOR_NO_PERMS", player); return false; } return true; @@ -106,7 +106,7 @@ public class TNTSimulatorListener implements Listener, Disable { private void simulatorShowHide(Player player, Function itemStackFunction, Location location) { TNTSimulator simulator = get(player); ItemStack itemStack = itemStackFunction.apply(player.getInventory()); - if (itemStack == null || !itemStack.isSimilar(WAND)) { + if (!ItemUtils.isItem(itemStack, "simulator")) { simulator.hide(); return; } @@ -116,7 +116,7 @@ public class TNTSimulatorListener implements Listener, Disable { @EventHandler public void onPlayerInteract(PlayerInteractEvent event) { - if (event.getItem() == null || !event.getItem().isSimilar(WAND)) { + if (!ItemUtils.isItem(event.getItem(), "simulator")) { return; } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index ce66267a..bcf3f099 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -322,13 +322,13 @@ public class TraceCommand extends SWCommand { @Register({"show", "raw"}) public void rawShowEntityCommand(Player p, ShowModeParameterType... showModeParameterTypes) { - internalShow(p, ShowModeType.RAW_ENTITY, showModeParameterTypes); + internalShow(p, ShowModeType.RAW, showModeParameterTypes); } @AllArgsConstructor private enum ShowModeType { ENTITY(TraceEntityShowMode::new), - RAW_ENTITY(RawEntityShowMode::new), + RAW(RawEntityShowMode::new), PARTICLE(ParticleShowMode::new), BLOCK(BlockShowMode::new); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/StopCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/StopCommand.java index 7c1beb8d..dcb69c01 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/StopCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/StopCommand.java @@ -29,7 +29,6 @@ import de.steamwar.command.GuardChecker; import de.steamwar.command.GuardResult; import de.steamwar.command.SWCommand; import de.steamwar.sql.SteamwarUser; -import de.steamwar.sql.UserGroup; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -41,7 +40,7 @@ public class StopCommand extends SWCommand { } @Register(description = "STOP_HELP") - public void genericCommand(Player p) { + public void genericCommand(@Guard Player p) { SWUtils.message(current -> BauSystem.MESSAGE.parsePrefixed("STOP_MESSAGE", current)); Bukkit.getServer().shutdown(); }