SteamWar/SpigotCore
Archiviert
13
0

Simplify SWCommandUtils

Dieser Commit ist enthalten in:
yoyosource 2021-05-05 08:54:24 +02:00
Ursprung 95fb899d14
Commit 2adab560c2

Datei anzeigen

@ -111,10 +111,16 @@ public class SWCommandUtils {
index++;
}
if (varArgType != null && index > args.length - 1) {
Object varArgument = Array.newInstance(varArgType, 0);
arguments[arguments.length - 1] = varArgument;
} else {
int length = 0;
if (varArgType != null) {
length = args.length - parameters.length - subCommand.length + 1;
arguments[arguments.length - 1] = Array.newInstance(varArgType, length);
if (index > args.length - 1) {
return arguments;
}
}
for (int i = 0; i < parameters.length - (varArgType != null ? 1 : 0); i++) {
arguments[i + 1] = parameters[i].map(commandSender, Arrays.copyOf(args, index), args[index]);
index++;
@ -124,9 +130,7 @@ public class SWCommandUtils {
}
if (varArgType != null) {
int length = args.length - parameters.length - subCommand.length + 1;
Object varArgument = Array.newInstance(varArgType, length);
arguments[arguments.length - 1] = varArgument;
Object varArgument = arguments[args.length - 1];
for (int i = 0; i < length; i++) {
Object value = parameters[parameters.length - 1].map(commandSender, Arrays.copyOf(args, index), args[index]);
@ -137,7 +141,6 @@ public class SWCommandUtils {
index++;
}
}
}
return arguments;
}