diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java index be01a34..00bee35 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java @@ -45,6 +45,18 @@ public class CommandGUI implements CommandExecutor, Listener { Bukkit.getScheduler().runTaskTimerAsynchronously(BauSystem.getPlugin(), LAST_F_PLAYER::clear, 0, 20); } + private static ItemStack wand(Player player, ItemStack base, String command, Permission permission, String noPermissionMessage) { + base = base.clone(); + ItemMeta meta = base.getItemMeta(); + List lore = meta.getLore(); + lore.add(command); + if (Welt.noPermission(player, permission)) + lore.add(noPermissionMessage); + meta.setLore(lore); + base.setItemMeta(meta); + return base; + } + public static void openBauGui(Player player) { Region region = Region.getRegion(player.getLocation()); SWInventory inv = new SWInventory(player, 5 * 9, SteamwarUser.get(BauSystem.getOwner()).getUserName() + "s Bau"); @@ -64,14 +76,7 @@ public class CommandGUI implements CommandExecutor, Listener { player.performCommand("gui item"); }); - ItemStack dtWand = Detonator.WAND.clone(); - ItemMeta meta = dtWand.getItemMeta(); - List lore = meta.getLore(); - lore.add("§8/§7dt wand"); - if (Welt.noPermission(player, Permission.world)) - lore.add("§cDu hast keine Worldrechte"); - meta.setLore(lore); - dtWand.setItemMeta(meta); + ItemStack dtWand = wand(player, Detonator.WAND, "§8/§7dt wand", Permission.world, "§cDu hast keine Worldrechte"); inv.setItem(39, dtWand, clickType -> { if (Welt.noPermission(player, Permission.world)) return; @@ -79,6 +84,14 @@ public class CommandGUI implements CommandExecutor, Listener { player.performCommand("dt wand"); }); + ItemStack simWand = wand(player, TNTSimulator.WAND, "§8/§7sim wand", Permission.world, "§cDu hast keine Worldrechte"); + inv.setItem(38, simWand, clickType -> { + if (Welt.noPermission(player, Permission.world)) + return; + player.closeInventory(); + player.performCommand("sim wand"); + }); + inv.setItem(40, getMaterial("WOODEN_AXE", "WOOD_AXE"), "§eWorldedit Axt", getNoPermsLore(Arrays.asList("§8//§7wand"), player, "§cDu hast keine Worldeditrechte", Permission.worldedit), false, clickType -> { if (Welt.noPermission(player, Permission.world)) return;