From 6744b8e0edf84aba1fcefdd55f35add68d113457 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 1 Apr 2021 20:31:59 +0200 Subject: [PATCH] Update CommandScript to new SWCommand system --- .../src/de/steamwar/bausystem/BauSystem.java | 2 +- .../bausystem/commands/CommandScript.java | 20 +++++++++---------- BauSystem_Main/src/plugin.yml | 1 - 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index 53178f6..c6a4af8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -93,7 +93,7 @@ public class BauSystem extends JavaPlugin implements Listener { new CommandDebugStick(); getCommand("watervision").setExecutor(new CommandGills()); new CommandDetonator(); - getCommand("script").setExecutor(new CommandScript()); + new CommandScript(); getCommand("scriptvars").setExecutor(new CommandScriptVars()); getCommand("scriptvars").setTabCompleter(new CommandScriptVarsTabCompleter()); new CommandSimulator(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandScript.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandScript.java index 1af6767..f54b373 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandScript.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandScript.java @@ -22,10 +22,8 @@ package de.steamwar.bausystem.commands; import de.steamwar.bausystem.SWUtils; +import de.steamwar.command.SWCommand; import org.bukkit.Material; -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.BookMeta; @@ -33,7 +31,11 @@ import org.bukkit.inventory.meta.BookMeta; import java.util.ArrayList; import java.util.List; -public class CommandScript implements CommandExecutor { +public class CommandScript extends SWCommand { + + public CommandScript() { + super("script"); + } public static final ItemStack BOOK = new ItemStack(Material.WRITTEN_BOOK, 1); @@ -79,13 +81,9 @@ public class CommandScript implements CommandExecutor { BOOK.setItemMeta(bookMeta); } - @Override - public boolean onCommand(CommandSender sender, Command command, String s, String[] args) { - if (!(sender instanceof Player)) { - return false; - } - SWUtils.giveItemToPlayer((Player) sender, BOOK); - return false; + @Register + public void giveCommand(Player p) { + SWUtils.giveItemToPlayer(p, BOOK); } } diff --git a/BauSystem_Main/src/plugin.yml b/BauSystem_Main/src/plugin.yml index 966b94c..a619a73 100644 --- a/BauSystem_Main/src/plugin.yml +++ b/BauSystem_Main/src/plugin.yml @@ -21,7 +21,6 @@ commands: watervision: aliases: wv lockschem: - script: scriptvars: gui: redstonetester: