From f2c3f65d769eda087e112e914fa16260bdc6eb70 Mon Sep 17 00:00:00 2001 From: DaTTV <104141141+DrFreezyYT@users.noreply.github.com> Date: Mon, 17 Feb 2025 18:19:58 +0100 Subject: [PATCH] Updated a libary! --- .../blazesmp/command/util/SimpleCommand.java | 33 +++++++------------ 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/src/main/java/me/freezy/plugins/papermc/blazesmp/command/util/SimpleCommand.java b/src/main/java/me/freezy/plugins/papermc/blazesmp/command/util/SimpleCommand.java index 53e9057..694225d 100644 --- a/src/main/java/me/freezy/plugins/papermc/blazesmp/command/util/SimpleCommand.java +++ b/src/main/java/me/freezy/plugins/papermc/blazesmp/command/util/SimpleCommand.java @@ -7,9 +7,9 @@ import org.jetbrains.annotations.NotNull; import java.lang.reflect.Field; import java.util.List; +import java.util.Objects; import java.util.logging.Logger; -@SuppressWarnings("ALL") public abstract class SimpleCommand implements CommandExecutor, TabExecutor { protected static Logger logger = Logger.getLogger(BlazeSMP.class.getName()); protected static CommandMap cmap; @@ -17,43 +17,33 @@ public abstract class SimpleCommand implements CommandExecutor, TabExecutor { protected final String description; protected final List alias; protected final String usage; - protected final String permissionMessage; protected final String permission; public SimpleCommand(String command) { - this(command, null, null, null, null, null); + this(command, null, null, null, null); } public SimpleCommand(String command, String usage) { - this(command, usage, null, null, null, null); + this(command, usage, null, null, null); } public SimpleCommand(String command, String usage, String description) { - this(command, usage, description, null, null, null); + this(command, usage, description, null, null); } public SimpleCommand(String command, String usage, String description, List alias) { - this(command, usage, description, null, null, alias); + this(command, usage, description, null, alias); } - public SimpleCommand(String command, String usage, String description, String permissionMessage) { - this(command, usage, description, permissionMessage, null, null); - } - - public SimpleCommand(String command, String usage, String description, String permissionMessage, String permission) { - this(command, usage, description, permissionMessage, permission, null); + public SimpleCommand(String command, String usage, String description, String permission) { + this(command, usage, description, permission, null); } public SimpleCommand(String command, String usage, String description, String permission, List alias) { - this(command, usage, description, null, permission, alias); - } - - public SimpleCommand(String command, String usage, String description, String permissionMessage, String permission, List alias) { this.command = command; this.description = description; this.alias = alias; this.usage = usage; - this.permissionMessage = permissionMessage; this.permission = permission; } @@ -62,7 +52,6 @@ public abstract class SimpleCommand implements CommandExecutor, TabExecutor { if (this.alias != null) cmd.setAliases(this.alias); if (this.description != null) cmd.setDescription(this.description); if (this.usage != null) cmd.setUsage(this.usage); - if (this.permissionMessage != null) cmd.setPermissionMessage(this.permissionMessage); if (this.permission != null) cmd.setPermission(this.permission); getCommandMap().register("blazesmp", cmd); cmd.setExecutor(this); @@ -104,11 +93,11 @@ public abstract class SimpleCommand implements CommandExecutor, TabExecutor { } @Override - public List tabComplete(@NotNull CommandSender sender, @NotNull String alias, String[] args) { + public @NotNull List tabComplete(@NotNull CommandSender sender, @NotNull String alias, String[] args) { if (exe != null) { - return exe.onTabComplete(sender, this, alias, args); + return Objects.requireNonNull(exe.onTabComplete(sender, this, alias, args)); } - return null; + return List.of(); } } -} \ No newline at end of file +}