SteamWar/SpigotCore
Archiviert
13
0

Simplify SubCommand

Dieser Commit ist enthalten in:
yoyosource 2021-05-05 08:47:01 +02:00
Ursprung d48175234a
Commit 95fb899d14

Datei anzeigen

@ -116,8 +116,9 @@ class SubCommand {
} }
for (TypeMapper<?> argument : arguments) { for (TypeMapper<?> argument : arguments) {
String s = argsList.remove(0); String s = argsList.remove(0);
if (argsList.isEmpty()) if (argsList.isEmpty()) {
return argument.tabCompletes(commandSender, Arrays.copyOf(args, args.length - 1), s); return argument.tabCompletes(commandSender, Arrays.copyOf(args, args.length - 1), s);
}
try { try {
if (argument.map(commandSender, Arrays.copyOf(args, index), s) == null) { if (argument.map(commandSender, Arrays.copyOf(args, index), s) == null) {
return null; return null;
@ -130,8 +131,9 @@ class SubCommand {
if (varArgType != null && !argsList.isEmpty()) { if (varArgType != null && !argsList.isEmpty()) {
while (!argsList.isEmpty()) { while (!argsList.isEmpty()) {
String s = argsList.remove(0); String s = argsList.remove(0);
if (argsList.isEmpty()) if (argsList.isEmpty()) {
return arguments[arguments.length - 1].tabCompletes(commandSender, Arrays.copyOf(args, args.length - 1), s); return arguments[arguments.length - 1].tabCompletes(commandSender, Arrays.copyOf(args, args.length - 1), s);
}
try { try {
if (arguments[arguments.length - 1].map(commandSender, Arrays.copyOf(args, index), s) == null) { if (arguments[arguments.length - 1].map(commandSender, Arrays.copyOf(args, index), s) == null) {
return null; return null;