Fixes some errors caused when calling a command without an argument
This commit is contained in:
parent
0ad953cc14
commit
4e44909f80
@ -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;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,11 @@ public class TokenizedTabCompleter implements TabCompleter {
|
||||
@Override
|
||||
public List<String> 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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user