From 70dc99de6fb94e1320e9e93ebc19e37a884b57f7 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 1 Apr 2021 20:23:24 +0200 Subject: [PATCH] Update CommandSkull to new SWCommand system --- .../src/de/steamwar/bausystem/BauSystem.java | 2 +- .../bausystem/commands/CommandSkull.java | 30 ++++++++----------- BauSystem_Main/src/plugin.yml | 1 - 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 4c5762a..f8f8243 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -87,7 +87,7 @@ public class BauSystem extends JavaPlugin implements Listener { new CommandTestblock(); getCommand("bauinfo").setExecutor(new CommandInfo()); getCommand("protect").setExecutor(new CommandProtect()); - getCommand("skull").setExecutor(new CommandSkull()); + new CommandSkull(); getCommand("loader").setExecutor(new CommandLoader()); getCommand("lockschem").setExecutor(new CommandLockschem()); new CommandDebugStick(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSkull.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSkull.java index 7cbab3a..24a8b51 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSkull.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSkull.java @@ -21,34 +21,30 @@ package de.steamwar.bausystem.commands; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.SWUtils; +import de.steamwar.command.SWCommand; import de.steamwar.inventory.SWItem; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.SkullMeta; -public class CommandSkull implements CommandExecutor { +public class CommandSkull extends SWCommand { - @Override - public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) { - if (!(commandSender instanceof Player)) - return false; - Player p = (Player) commandSender; + public CommandSkull() { + super("skull"); + } - if (args.length != 1) { - p.sendMessage(BauSystem.PREFIX + "§8/§eskull §8[§eSpieler§8]"); - return false; - } + @Register(help = true) + public void genericHelp(Player p, String... args) { + p.sendMessage(BauSystem.PREFIX + "§8/§eskull §8[§eSpieler§8]"); + } - ItemStack is = SWItem.getPlayerSkull(args[0]).getItemStack(); + @Register + public void giveHelp(Player p, String skull) { + ItemStack is = SWItem.getPlayerSkull(skull).getItemStack(); SkullMeta sm = (SkullMeta) is.getItemMeta(); assert sm != null; - sm.setDisplayName("§e" + args[0] + "§8s Kopf"); + sm.setDisplayName("§e" + skull + "§8s Kopf"); is.setItemMeta(sm); SWUtils.giveItemToPlayer(p, is); - - return false; } } diff --git a/BauSystem_Main/src/plugin.yml b/BauSystem_Main/src/plugin.yml index b8f6b67..0129c49 100644 --- a/BauSystem_Main/src/plugin.yml +++ b/BauSystem_Main/src/plugin.yml @@ -13,7 +13,6 @@ commands: reset: protect: bauinfo: - skull: freeze: aliases: stoplag loader: