From 7e9f7139fd11f7f99045ba395be85c1f3d56ea5f Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 4 Apr 2021 18:59:02 +0200 Subject: [PATCH] Remove Permission.build --- .../src/de/steamwar/bausystem/Permission.java | 6 +- .../bausystem/commands/CommandGUI.java | 68 ++++++++++--------- .../bausystem/world/RegionListener.java | 3 +- .../src/de/steamwar/bausystem/world/Welt.java | 6 +- 4 files changed, 42 insertions(+), 41 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/Permission.java b/BauSystem_Main/src/de/steamwar/bausystem/Permission.java index dc92701..f3e5085 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/Permission.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/Permission.java @@ -20,7 +20,7 @@ package de.steamwar.bausystem; public enum Permission { - world, - worldedit, - member + WORLD, + WORLDEDIT, + MEMBER } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java index 7cdccfa..b403982 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java @@ -25,6 +25,8 @@ import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.tracer.record.RecordStateMachine; import de.steamwar.bausystem.tracer.show.TraceShowManager; import de.steamwar.bausystem.world.*; +import de.steamwar.bausystem.world.regions.GlobalRegion; +import de.steamwar.bausystem.world.regions.Region; import de.steamwar.command.SWCommand; import de.steamwar.core.Core; import de.steamwar.inventory.SWAnvilInv; @@ -95,17 +97,17 @@ public class CommandGUI extends SWCommand implements Listener { player.performCommand("gui item"); }); - ItemStack dtWand = wand(player, Detonator.WAND, "§8/§7dt wand", Permission.world, "§cDu hast keine Worldrechte"); + 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)) + if (Welt.noPermission(player, Permission.WORLD)) return; player.closeInventory(); player.performCommand("dt wand"); }); - ItemStack simWand = wand(player, TNTSimulator.WAND, "§8/§7sim wand", Permission.world, "§cDu hast keine Worldrechte"); + 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)) + if (Welt.noPermission(player, Permission.WORLD)) return; player.closeInventory(); player.performCommand("sim wand"); @@ -117,21 +119,21 @@ public class CommandGUI extends SWCommand implements Listener { player.performCommand("redstonetester"); }); - 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)) + 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; player.closeInventory(); player.performCommand("/wand"); }); - 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)) + 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(20, Material.COMPASS, "§7TPS Limitieren", getNoPermsLore(Arrays.asList("§7Aktuell: §e" + CommandTPSLimiter.getCurrentTPSLimit(), "§8/§7tpslimit §8[§e0,5 - " + (TPSUtils.isWarpAllowed() ? 40 : 20) + "§8]"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> { - if (Welt.noPermission(player, Permission.world)) + inv.setItem(20, Material.COMPASS, "§7TPS Limitieren", getNoPermsLore(Arrays.asList("§7Aktuell: §e" + CommandTPSLimiter.getCurrentTPSLimit(), "§8/§7tpslimit §8[§e0,5 - " + (TPSUtils.isWarpAllowed() ? 40 : 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); @@ -166,16 +168,16 @@ public class CommandGUI extends SWCommand implements Listener { scriptBooksGUI(player); }); - inv.setItem(21, Material.OBSERVER, "§7Tracer", getNoPermsLore(Arrays.asList("§7Status: §e" + RecordStateMachine.getRecordStatus().getName()), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> { - if (Welt.noPermission(player, Permission.world)) + inv.setItem(21, Material.OBSERVER, "§7Tracer", getNoPermsLore(Arrays.asList("§7Status: §e" + RecordStateMachine.getRecordStatus().getName()), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> { + if (Welt.noPermission(player, Permission.WORLD)) return; player.closeInventory(); OPEN_TRACER_INVS.add(player); traceGUI(player); }); - 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)) + 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(); autoLoaderGUI(player); @@ -188,7 +190,7 @@ public class CommandGUI extends SWCommand implements Listener { anvilInv.open(); }); - if (Region.GlobalRegion.isGlobalRegion(region)) { + if (GlobalRegion.isGlobalRegion(region)) { inv.setItem(9, Material.BARRIER, "§eKeine Region", clickType -> { }); inv.setItem(18, Material.BARRIER, "§eKeine Region", clickType -> { @@ -196,15 +198,15 @@ public class CommandGUI extends SWCommand implements Listener { inv.setItem(27, Material.BARRIER, "§eKeine Region", clickType -> { }); } else { - inv.setItem(27, getMaterial("HEAVY_WEIGHTED_PRESSURE_PLATE", "IRON_PLATE"), "§eRegion Reseten", getNoPermsLore(Arrays.asList("§8/§7reset"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> { - if (Welt.noPermission(player, Permission.world)) + inv.setItem(27, getMaterial("HEAVY_WEIGHTED_PRESSURE_PLATE", "IRON_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 -> { - if (Welt.noPermission(player, Permission.world)) + 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)); }); @@ -214,8 +216,8 @@ public class CommandGUI extends SWCommand implements Listener { } 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 -> { - if (Welt.noPermission(player, Permission.world)) + 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)); }); @@ -250,11 +252,11 @@ public class CommandGUI extends SWCommand implements Listener { } 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); + 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 -> { - if (Welt.noPermission(player, Permission.world)) + if (Welt.noPermission(player, Permission.WORLD)) return; player.performCommand("tnt " + (isBuildArea ? "tb" : "on")); updateInventories(); @@ -262,7 +264,7 @@ public class CommandGUI extends SWCommand implements Listener { break; case ONLY_TB: inv.setItem(23, getMaterial("TNT_MINECART", "EXPLOSIVE_MINECART"), "§7TNT: §enur Testblock", tntLore, false, clickType -> { - if (Welt.noPermission(player, Permission.world)) + if (Welt.noPermission(player, Permission.WORLD)) return; player.performCommand("tnt on"); updateInventories(); @@ -270,7 +272,7 @@ public class CommandGUI extends SWCommand implements Listener { break; default: inv.setItem(23, Material.TNT, "§7TNT: §eEingeschaltet", tntLore, false, clickType -> { - if (Welt.noPermission(player, Permission.world)) + if (Welt.noPermission(player, Permission.WORLD)) return; player.performCommand("tnt off"); updateInventories(); @@ -278,15 +280,15 @@ public class CommandGUI extends SWCommand implements Listener { } if (region.isFreeze()) { - inv.setItem(24, getMaterial("GUNPOWDER", "SULPHUR"), "§7Freeze: §eEingeschaltet", getNoPermsLore(Arrays.asList("§8/§7freeze"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> { - if (Welt.noPermission(player, Permission.world)) + inv.setItem(24, getMaterial("GUNPOWDER", "SULPHUR"), "§7Freeze: §eEingeschaltet", getNoPermsLore(Arrays.asList("§8/§7freeze"), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> { + if (Welt.noPermission(player, Permission.WORLD)) return; player.performCommand("freeze"); updateInventories(); }); } else { - inv.setItem(24, Material.REDSTONE, "§7Freeze: §eAusgeschaltet", getNoPermsLore(Arrays.asList("§8/§7freeze"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> { - if (Welt.noPermission(player, Permission.world)) + inv.setItem(24, Material.REDSTONE, "§7Freeze: §eAusgeschaltet", getNoPermsLore(Arrays.asList("§8/§7freeze"), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> { + if (Welt.noPermission(player, Permission.WORLD)) return; player.performCommand("freeze"); updateInventories(); @@ -294,15 +296,15 @@ public class CommandGUI extends SWCommand implements Listener { } if (region.isFire()) { - inv.setItem(3, getMaterial("FIREWORK_STAR", "FIREWORK_CHARGE"), "§7Fire: §eAusgeschaltet", getNoPermsLore(Arrays.asList("§8/§7fire"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> { - if (Welt.noPermission(player, Permission.world)) + inv.setItem(3, getMaterial("FIREWORK_STAR", "FIREWORK_CHARGE"), "§7Fire: §eAusgeschaltet", getNoPermsLore(Arrays.asList("§8/§7fire"), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> { + if (Welt.noPermission(player, Permission.WORLD)) return; player.performCommand("fire"); updateInventories(); }); } else { - inv.setItem(3, getMaterial("FIRE_CHARGE", "FIREBALL"), "§7Fire: §eEingeschaltet", getNoPermsLore(Arrays.asList("§8/§7fire"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> { - if (Welt.noPermission(player, Permission.world)) + inv.setItem(3, getMaterial("FIRE_CHARGE", "FIREBALL"), "§7Fire: §eEingeschaltet", getNoPermsLore(Arrays.asList("§8/§7fire"), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> { + if (Welt.noPermission(player, Permission.WORLD)) return; player.performCommand("fire"); updateInventories(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/RegionListener.java b/BauSystem_Main/src/de/steamwar/bausystem/world/RegionListener.java index ead9a3c..b32d6e9 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/RegionListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/RegionListener.java @@ -28,7 +28,6 @@ import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.wrappers.BlockPosition; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.core.Core; import de.steamwar.core.VersionedCallable; import de.steamwar.core.VersionedRunnable; import org.bukkit.Bukkit; @@ -53,7 +52,7 @@ public class RegionListener implements Listener { Player p = e.getPlayer(); - if (Welt.noPermission(p, Permission.worldedit)) { + if (Welt.noPermission(p, Permission.WORLDEDIT)) { p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier kein WorldEdit benutzen"); e.setCancelled(true); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/Welt.java b/BauSystem_Main/src/de/steamwar/bausystem/world/Welt.java index c5c411c..ee68461 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/Welt.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/Welt.java @@ -40,11 +40,11 @@ public class Welt { return true; switch (perm) { - case worldedit: + case WORLDEDIT: return !member1.isWorldEdit(); - case world: + case WORLD: return !member1.isWorld(); - case member: + case MEMBER: return false; default: return true;