SteamWar/BauSystem
Archiviert
13
0

Remove Permission.build

Dieser Commit ist enthalten in:
yoyosource 2021-04-04 18:59:02 +02:00
Ursprung dc4bbf3faa
Commit 7e9f7139fd
4 geänderte Dateien mit 42 neuen und 41 gelöschten Zeilen

Datei anzeigen

@ -20,7 +20,7 @@
package de.steamwar.bausystem; package de.steamwar.bausystem;
public enum Permission { public enum Permission {
world, WORLD,
worldedit, WORLDEDIT,
member MEMBER
} }

Datei anzeigen

@ -25,6 +25,8 @@ import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.tracer.record.RecordStateMachine; import de.steamwar.bausystem.tracer.record.RecordStateMachine;
import de.steamwar.bausystem.tracer.show.TraceShowManager; import de.steamwar.bausystem.tracer.show.TraceShowManager;
import de.steamwar.bausystem.world.*; 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.command.SWCommand;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.inventory.SWAnvilInv; import de.steamwar.inventory.SWAnvilInv;
@ -95,17 +97,17 @@ public class CommandGUI extends SWCommand implements Listener {
player.performCommand("gui item"); 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 -> { inv.setItem(39, dtWand, clickType -> {
if (Welt.noPermission(player, Permission.world)) if (Welt.noPermission(player, Permission.WORLD))
return; return;
player.closeInventory(); player.closeInventory();
player.performCommand("dt wand"); 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 -> { inv.setItem(38, simWand, clickType -> {
if (Welt.noPermission(player, Permission.world)) if (Welt.noPermission(player, Permission.WORLD))
return; return;
player.closeInventory(); player.closeInventory();
player.performCommand("sim wand"); player.performCommand("sim wand");
@ -117,21 +119,21 @@ public class CommandGUI extends SWCommand implements Listener {
player.performCommand("redstonetester"); 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 -> { 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)) if (Welt.noPermission(player, Permission.WORLD))
return; return;
player.closeInventory(); player.closeInventory();
player.performCommand("/wand"); 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 -> { 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)) if (Welt.noPermission(player, Permission.WORLD))
return; return;
player.closeInventory(); player.closeInventory();
player.performCommand("debugstick"); 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 -> { 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)) if (Welt.noPermission(player, Permission.WORLD))
return; return;
SWAnvilInv anvilInv = new SWAnvilInv(player, "TPS Limitieren"); SWAnvilInv anvilInv = new SWAnvilInv(player, "TPS Limitieren");
anvilInv.setItem(Material.COMPASS); anvilInv.setItem(Material.COMPASS);
@ -166,16 +168,16 @@ public class CommandGUI extends SWCommand implements Listener {
scriptBooksGUI(player); 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 -> { 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)) if (Welt.noPermission(player, Permission.WORLD))
return; return;
player.closeInventory(); player.closeInventory();
OPEN_TRACER_INVS.add(player); OPEN_TRACER_INVS.add(player);
traceGUI(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 -> { 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)) if (Welt.noPermission(player, Permission.WORLD))
return; return;
player.closeInventory(); player.closeInventory();
autoLoaderGUI(player); autoLoaderGUI(player);
@ -188,7 +190,7 @@ public class CommandGUI extends SWCommand implements Listener {
anvilInv.open(); anvilInv.open();
}); });
if (Region.GlobalRegion.isGlobalRegion(region)) { if (GlobalRegion.isGlobalRegion(region)) {
inv.setItem(9, Material.BARRIER, "§eKeine Region", clickType -> { inv.setItem(9, Material.BARRIER, "§eKeine Region", clickType -> {
}); });
inv.setItem(18, 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 -> { inv.setItem(27, Material.BARRIER, "§eKeine Region", clickType -> {
}); });
} else { } 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 -> { 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)) if (Welt.noPermission(player, Permission.WORLD))
return; return;
confirmationInventory(player, "Region Reseten?", () -> player.performCommand("reset"), () -> openBauGui(player)); confirmationInventory(player, "Region Reseten?", () -> player.performCommand("reset"), () -> openBauGui(player));
}); });
if (region.hasProtection()) { if (region.hasProtection()) {
inv.setItem(18, Material.OBSIDIAN, "§eRegion Protecten", getNoPermsLore(Arrays.asList("§8/§7protect"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> { 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)) if (Welt.noPermission(player, Permission.WORLD))
return; return;
confirmationInventory(player, "Region Protecten", () -> player.performCommand("protect"), () -> openBauGui(player)); confirmationInventory(player, "Region Protecten", () -> player.performCommand("protect"), () -> openBauGui(player));
}); });
@ -214,8 +216,8 @@ public class CommandGUI extends SWCommand implements Listener {
} }
if (region.hasTestblock()) { 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 -> { 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)) if (Welt.noPermission(player, Permission.WORLD))
return; return;
confirmationInventory(player, "Testblock erneuern", () -> player.performCommand("testblock"), () -> openBauGui(player)); confirmationInventory(player, "Testblock erneuern", () -> player.performCommand("testblock"), () -> openBauGui(player));
}); });
@ -250,11 +252,11 @@ public class CommandGUI extends SWCommand implements Listener {
} }
boolean isBuildArea = region.hasBuildRegion(); boolean isBuildArea = region.hasBuildRegion();
List<String> tntLore = getNoPermsLore(Arrays.asList("§8/§7tnt §8[" + (isBuildArea ? "§eTB§7, " : "") + "§eOff §7oder §eOn§7]"), player, "§cDu hast keine Worldrechte", Permission.world); List<String> tntLore = getNoPermsLore(Arrays.asList("§8/§7tnt §8[" + (isBuildArea ? "§eTB§7, " : "") + "§eOff §7oder §eOn§7]"), player, "§cDu hast keine Worldrechte", Permission.WORLD);
switch (region.getTntMode()) { switch (region.getTntMode()) {
case OFF: case OFF:
inv.setItem(23, Material.MINECART, "§7TNT: §eAusgeschaltet", tntLore, false, clickType -> { inv.setItem(23, Material.MINECART, "§7TNT: §eAusgeschaltet", tntLore, false, clickType -> {
if (Welt.noPermission(player, Permission.world)) if (Welt.noPermission(player, Permission.WORLD))
return; return;
player.performCommand("tnt " + (isBuildArea ? "tb" : "on")); player.performCommand("tnt " + (isBuildArea ? "tb" : "on"));
updateInventories(); updateInventories();
@ -262,7 +264,7 @@ public class CommandGUI extends SWCommand implements Listener {
break; break;
case ONLY_TB: case ONLY_TB:
inv.setItem(23, getMaterial("TNT_MINECART", "EXPLOSIVE_MINECART"), "§7TNT: §enur Testblock", tntLore, false, clickType -> { 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; return;
player.performCommand("tnt on"); player.performCommand("tnt on");
updateInventories(); updateInventories();
@ -270,7 +272,7 @@ public class CommandGUI extends SWCommand implements Listener {
break; break;
default: default:
inv.setItem(23, Material.TNT, "§7TNT: §eEingeschaltet", tntLore, false, clickType -> { inv.setItem(23, Material.TNT, "§7TNT: §eEingeschaltet", tntLore, false, clickType -> {
if (Welt.noPermission(player, Permission.world)) if (Welt.noPermission(player, Permission.WORLD))
return; return;
player.performCommand("tnt off"); player.performCommand("tnt off");
updateInventories(); updateInventories();
@ -278,15 +280,15 @@ public class CommandGUI extends SWCommand implements Listener {
} }
if (region.isFreeze()) { 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 -> { 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)) if (Welt.noPermission(player, Permission.WORLD))
return; return;
player.performCommand("freeze"); player.performCommand("freeze");
updateInventories(); updateInventories();
}); });
} else { } else {
inv.setItem(24, Material.REDSTONE, "§7Freeze: §eAusgeschaltet", getNoPermsLore(Arrays.asList("§8/§7freeze"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> { 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)) if (Welt.noPermission(player, Permission.WORLD))
return; return;
player.performCommand("freeze"); player.performCommand("freeze");
updateInventories(); updateInventories();
@ -294,15 +296,15 @@ public class CommandGUI extends SWCommand implements Listener {
} }
if (region.isFire()) { 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 -> { 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)) if (Welt.noPermission(player, Permission.WORLD))
return; return;
player.performCommand("fire"); player.performCommand("fire");
updateInventories(); updateInventories();
}); });
} else { } else {
inv.setItem(3, getMaterial("FIRE_CHARGE", "FIREBALL"), "§7Fire: §eEingeschaltet", getNoPermsLore(Arrays.asList("§8/§7fire"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> { 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)) if (Welt.noPermission(player, Permission.WORLD))
return; return;
player.performCommand("fire"); player.performCommand("fire");
updateInventories(); updateInventories();

Datei anzeigen

@ -28,7 +28,6 @@ import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.wrappers.BlockPosition; import com.comphenix.protocol.wrappers.BlockPosition;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.core.Core;
import de.steamwar.core.VersionedCallable; import de.steamwar.core.VersionedCallable;
import de.steamwar.core.VersionedRunnable; import de.steamwar.core.VersionedRunnable;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -53,7 +52,7 @@ public class RegionListener implements Listener {
Player p = e.getPlayer(); 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"); p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier kein WorldEdit benutzen");
e.setCancelled(true); e.setCancelled(true);
} }

Datei anzeigen

@ -40,11 +40,11 @@ public class Welt {
return true; return true;
switch (perm) { switch (perm) {
case worldedit: case WORLDEDIT:
return !member1.isWorldEdit(); return !member1.isWorldEdit();
case world: case WORLD:
return !member1.isWorld(); return !member1.isWorld();
case member: case MEMBER:
return false; return false;
default: default:
return true; return true;