SteamWar/BauSystem
Archiviert
13
0

Add Simulator Wand to CommandGUI

Dieser Commit ist enthalten in:
yoyosource 2021-03-06 21:35:33 +01:00
Ursprung 9a1c900a71
Commit bed5a74c10

Datei anzeigen

@ -45,6 +45,18 @@ public class CommandGUI implements CommandExecutor, Listener {
Bukkit.getScheduler().runTaskTimerAsynchronously(BauSystem.getPlugin(), LAST_F_PLAYER::clear, 0, 20); 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<String> 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) { public static void openBauGui(Player player) {
Region region = Region.getRegion(player.getLocation()); Region region = Region.getRegion(player.getLocation());
SWInventory inv = new SWInventory(player, 5 * 9, SteamwarUser.get(BauSystem.getOwner()).getUserName() + "s Bau"); 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"); player.performCommand("gui item");
}); });
ItemStack dtWand = Detonator.WAND.clone(); ItemStack dtWand = wand(player, Detonator.WAND, "§8/§7dt wand", Permission.world, "§cDu hast keine Worldrechte");
ItemMeta meta = dtWand.getItemMeta();
List<String> 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);
inv.setItem(39, dtWand, clickType -> { inv.setItem(39, dtWand, clickType -> {
if (Welt.noPermission(player, Permission.world)) if (Welt.noPermission(player, Permission.world))
return; return;
@ -79,6 +84,14 @@ public class CommandGUI implements CommandExecutor, Listener {
player.performCommand("dt wand"); 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 -> { 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;