diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java index 5f16601..c9231bc 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java @@ -49,8 +49,17 @@ public class CommandGUI implements CommandExecutor, Listener { if(!(commandSender instanceof Player)) return false; Player player = ((Player) commandSender); - openBauGui(player); - OPEN_INVS.add(player); + if(strings.length == 0) { + openBauGui(player); + OPEN_INVS.add(player); + }else { + if ("item".equalsIgnoreCase(strings[0])) { + if (player.getInventory().getItemInMainHand().getType() == Material.AIR) + player.getInventory().setItemInMainHand(new ItemStack(Material.NETHER_STAR)); + else + player.getInventory().addItem(new ItemStack(Material.NETHER_STAR)); + } + } return true; } @@ -65,6 +74,10 @@ public class CommandGUI implements CommandExecutor, Listener { inv.setItem(37, Material.GLASS_PANE, "§7Platzhalter", clickType -> {}); inv.setItem(38, Material.GLASS_PANE, "§7Platzhalter", clickType -> {}); inv.setItem(43, Material.GLASS_PANE, "§7Platzhalter", clickType -> {}); + inv.setItem(42, Material.NETHER_STAR, "§7Bau GUI Item", Arrays.asList("§7Du kannst dieses Item zum Öffnen der BauGUI nutzen", "§7oder Doppel F (Swap hands) drücken."), false, clickType -> { + player.closeInventory(); + player.performCommand("gui item"); + }); ItemStack dtWand = Detonator.WAND.clone(); ItemMeta meta = dtWand.getItemMeta(); @@ -75,6 +88,8 @@ public class CommandGUI implements CommandExecutor, Listener { meta.setLore(lore); dtWand.setItemMeta(meta); inv.setItem(39, dtWand, clickType -> { + if(Welt.noPermission(player, Permission.world)) + return; player.closeInventory(); player.performCommand("dt wand"); }); @@ -85,13 +100,16 @@ public class CommandGUI implements CommandExecutor, Listener { player.closeInventory(); player.performCommand("/wand"); }); - inv.setItem(41, getMaterial("DEBUG_STICK", "STICK"), "§7Debugstick", Arrays.asList("§8/§7debugstick"), Core.getVersion() < 13,clickType -> { + inv.setItem(41, getMaterial("DEBUG_STICK", "STICK"), "§eDebugstick", getNoPermsLore(Arrays.asList("§8/§7debugstick"), player, "§cDu hast keine Worldrechte", Permission.world), Core.getVersion() < 13,clickType -> { + if(Welt.noPermission(player, Permission.world)) + return; player.closeInventory(); player.performCommand("debugstick"); }); - inv.setItem(42, Material.GLASS_PANE, "§7Platzhalter", clickType -> {}); inv.setItem(20, Material.COMPASS, "§7TPS Limitieren", getNoPermsLore(Arrays.asList("§7Aktuell: §e" + CommandTPSLimiter.getCurrentTPSLimit(), "§8/§7tpslimit §8[§e1 - 20§8]"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> { + if(Welt.noPermission(player, Permission.world)) + return; SWAnvilInv anvilInv = new SWAnvilInv(player, "TPS Limitieren"); anvilInv.setItem(Material.COMPASS); anvilInv.setCallback(s -> player.performCommand("tpslimit " + s)); @@ -133,7 +151,7 @@ public class CommandGUI implements CommandExecutor, Listener { traceGUI(player); }); - inv.setItem(22, Material.DISPENSER, "§7Auto-Loader", getNoPermsLore(Arrays.asList((AutoLoader.hasLoader(player) ? "§aan" : "§caus")), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> { + inv.setItem(22, Material.DISPENSER, "§7Auto-Loader", getNoPermsLore(Arrays.asList("§7Status: " + (AutoLoader.hasLoader(player) ? "§aan" : "§caus")), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> { if(Welt.noPermission(player, Permission.world)) return; player.closeInventory(); @@ -152,19 +170,28 @@ public class CommandGUI implements CommandExecutor, Listener { inv.setItem(18, Material.BARRIER, "§eKeine Region", clickType -> {}); inv.setItem(27, Material.BARRIER, "§eKeine Region", clickType -> {}); }else { - inv.setItem(27, Material.HEAVY_WEIGHTED_PRESSURE_PLATE, "§eRegion Reseten", getNoPermsLore(Arrays.asList("§8/§7reset"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> - confirmationInventory(player, "Region Reseten?", () -> player.performCommand("reset"), () -> openBauGui(player))); + inv.setItem(27, Material.HEAVY_WEIGHTED_PRESSURE_PLATE, "§eRegion Reseten", getNoPermsLore(Arrays.asList("§8/§7reset"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> { + if(Welt.noPermission(player, Permission.world)) + return; + confirmationInventory(player, "Region Reseten?", () -> player.performCommand("reset"), () -> openBauGui(player)); + }); if(region.hasProtection()) { - inv.setItem(18, Material.OBSIDIAN, "§eRegion Protecten", getNoPermsLore(Arrays.asList("§8/§7protect"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> - confirmationInventory(player, "Region Protecten", () -> player.performCommand("protect"), () -> openBauGui(player))); + inv.setItem(18, Material.OBSIDIAN, "§eRegion Protecten", getNoPermsLore(Arrays.asList("§8/§7protect"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> { + if(Welt.noPermission(player, Permission.world)) + return; + confirmationInventory(player, "Region Protecten", () -> player.performCommand("protect"), () -> openBauGui(player)); + }); } else { inv.setItem(18, Material.BARRIER, "§eRegion nicht Protect bar", clickType -> {}); } if(region.hasTestblock()) { - inv.setItem(9, getMaterial("END_STONE", "ENDER_STONE"), "§eTestblock erneuern", getNoPermsLore(Arrays.asList("§8/§7testblock"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> - confirmationInventory(player, "Testblock erneuern", () -> player.performCommand("testblock"), () -> openBauGui(player))); + inv.setItem(9, getMaterial("END_STONE", "ENDER_STONE"), "§eTestblock erneuern", getNoPermsLore(Arrays.asList("§8/§7testblock"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> { + if(Welt.noPermission(player, Permission.world)) + return; + confirmationInventory(player, "Testblock erneuern", () -> player.performCommand("testblock"), () -> openBauGui(player)); + }); } else { inv.setItem(9, Material.BARRIER, "§eDie Region hat keinen Testblock", clickType -> {}); } @@ -194,8 +221,8 @@ public class CommandGUI implements CommandExecutor, Listener { }); } - boolean isBuildArea = region.buildAreaEnabled(); - List tntLore = getNoPermsLore(Arrays.asList("§8/§7tnt §8[" + (isBuildArea?"§eTB§7, ":"") + "§eOff §7oder §eOn§7]"), player, "§cDu hast keine Worldrechte", Permission.world); + boolean isBuildArea = region.hasBuildRegion(); + List tntLore = getNoPermsLore(Arrays.asList("§8/§7tnt §8[" + (isBuildArea ? "§eTB§7, " : "") + "§eOff §7oder §eOn§7]"), player, "§cDu hast keine Worldrechte", Permission.world); switch (region.getTntMode()) { case OFF: inv.setItem(23, Material.MINECART, "§7TNT: §eAusgeschaltet", tntLore, false, clickType -> { @@ -255,6 +282,8 @@ public class CommandGUI implements CommandExecutor, Listener { } inv.setItem(2, Material.ENDER_PEARL, "§7Teleporter", getNoPermsLore(Arrays.asList("§8/§7tp §8[§eSpieler§8]"), player, "§cDu hast keine Buildrechte", Permission.build), false, clickType -> { + if(Welt.noPermission(player, Permission.build)) + return; List> playerSWListEntry = new ArrayList<>(); Bukkit.getOnlinePlayers().forEach(player1 -> { if(player1.equals(player)) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/Detonator.java b/BauSystem_Main/src/de/steamwar/bausystem/world/Detonator.java index 6ffb1f2..d63472d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/Detonator.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/Detonator.java @@ -51,7 +51,7 @@ public class Detonator implements Listener { WAND = new ItemStack(Material.BLAZE_ROD, 1); ItemMeta im = WAND.getItemMeta(); - im.setDisplayName("§6Fernzünder"); + im.setDisplayName("§eFernzünder"); List lorelist = Arrays.asList("§eLinks Klick §8- §7Setzte einen Punkt zum Aktivieren", "§eLinks Klick + Shift §8- §7Füge einen Punkt hinzu", "§eRechts Klick §8- §7Löse alle Punkte aus");