From 91b8d2db1b0b10cda60aa6cdb7bee8b13414f8e8 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 1 Apr 2021 20:43:31 +0200 Subject: [PATCH] Update CommandNV to new SWCommand system --- .../src/de/steamwar/bausystem/BauSystem.java | 2 +- .../bausystem/commands/CommandNV.java | 20 +++++++++---------- BauSystem_Main/src/plugin.yml | 2 -- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index 40a3694..cae5a18 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -77,7 +77,7 @@ public class BauSystem extends JavaPlugin implements Listener { new CommandTrace(); new CommandTPSLimiter(); - getCommand("nightvision").setExecutor(new CommandNV()); + new CommandNV(); new CommandReset(); new CommandSpeed(); new CommandTNT(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandNV.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandNV.java index 196887d..da22b91 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandNV.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandNV.java @@ -20,22 +20,20 @@ package de.steamwar.bausystem.commands; import de.steamwar.bausystem.BauSystem; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; +import de.steamwar.command.SWCommand; import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -public class CommandNV implements CommandExecutor { +public class CommandNV extends SWCommand { - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - if (!(sender instanceof Player)) - return false; - Player player = (Player) sender; - toggleNightvision(player); - return false; + public CommandNV() { + super("nightvision", "nv"); + } + + @Register + public void genericCommand(Player p) { + toggleNightvision(p); } public static void toggleNightvision(Player player) { diff --git a/BauSystem_Main/src/plugin.yml b/BauSystem_Main/src/plugin.yml index f1fa10e..b8c5d83 100644 --- a/BauSystem_Main/src/plugin.yml +++ b/BauSystem_Main/src/plugin.yml @@ -14,8 +14,6 @@ commands: freeze: aliases: stoplag loader: - nightvision: - aliases: nv watervision: aliases: wv lockschem: