From 801211c57d111caa3e163b81d97044688668d62e Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 7 Mar 2021 10:25:05 +0100 Subject: [PATCH] Update pr stuff --- .../src/de/steamwar/bausystem/BauSystem.java | 1 - .../bausystem/commands/CommandGUI.java | 24 +++++++++---------- .../bausystem/commands/CommandSimulator.java | 8 ++----- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index 8cd5112..c388e29 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -19,7 +19,6 @@ package de.steamwar.bausystem; -import de.steamwar.bausystem.world.TNTSimulatorListener; import de.steamwar.bausystem.commands.*; import de.steamwar.bausystem.world.*; import de.steamwar.core.CommandRemover; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java index a5f0ccb..5576d67 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java @@ -45,18 +45,6 @@ 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"); @@ -578,6 +566,18 @@ public class CommandGUI implements CommandExecutor, Listener { return null; } + 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; + } + @Override public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) { if (!(commandSender instanceof Player)) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSimulator.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSimulator.java index e73a2e7..a4dfcd8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSimulator.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSimulator.java @@ -22,6 +22,7 @@ package de.steamwar.bausystem.commands; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; +import de.steamwar.bausystem.PlayerUtils; import de.steamwar.bausystem.world.TNTSimulator; import de.steamwar.bausystem.world.Welt; import org.bukkit.Material; @@ -59,12 +60,7 @@ public class CommandSimulator implements CommandExecutor { if (args.length == 1) { switch (args[0].toLowerCase()) { case "wand": - if (player.getInventory().getItemInMainHand().getType() == Material.AIR) { - player.getInventory().setItemInMainHand(TNTSimulator.WAND); - } else { - player.getInventory().addItem(TNTSimulator.WAND); - } - player.updateInventory(); + PlayerUtils.giveItemToPlayer(player, TNTSimulator.WAND); break; case "start": TNTSimulator.get(player).start();