diff --git a/src/main/java/net/knarcraft/paidsigns/command/TokenizedCommand.java b/src/main/java/net/knarcraft/paidsigns/command/TokenizedCommand.java index bbd6802..a9f1146 100644 --- a/src/main/java/net/knarcraft/paidsigns/command/TokenizedCommand.java +++ b/src/main/java/net/knarcraft/paidsigns/command/TokenizedCommand.java @@ -19,7 +19,11 @@ public class TokenizedCommand implements CommandExecutor { @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { arguments = Tokenizer.tokenize(String.join(" ", args)); - argumentSize = args[args.length - 1].isEmpty() ? arguments.size() : arguments.size() - 1; + if (args.length == 0) { + argumentSize = 0; + } else { + argumentSize = args[args.length - 1].isEmpty() ? arguments.size() : arguments.size() - 1; + } return true; } diff --git a/src/main/java/net/knarcraft/paidsigns/command/TokenizedTabCompleter.java b/src/main/java/net/knarcraft/paidsigns/command/TokenizedTabCompleter.java index 2d78bc0..d5b6b0a 100644 --- a/src/main/java/net/knarcraft/paidsigns/command/TokenizedTabCompleter.java +++ b/src/main/java/net/knarcraft/paidsigns/command/TokenizedTabCompleter.java @@ -21,7 +21,11 @@ public class TokenizedTabCompleter implements TabCompleter { @Override public List onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) { arguments = Tokenizer.tokenize(String.join(" ", args)); - argumentSize = args[args.length - 1].isEmpty() ? arguments.size() : arguments.size() - 1; + if (args.length == 0) { + argumentSize = 0; + } else { + argumentSize = args[args.length - 1].isEmpty() ? arguments.size() : arguments.size() - 1; + } return null; }