mirror of
https://github.com/Minestom/Minestom.git
synced 2024-09-29 23:17:59 +02:00
Fixed Argument#useRemaining creating an empty array
This commit is contained in:
parent
b575d6df57
commit
b84bcde84d
@ -110,6 +110,7 @@ public class CommandDispatcher {
|
||||
final String[] argsValues = new String[arguments.length];
|
||||
|
||||
boolean syntaxCorrect = true;
|
||||
// The current index in the raw command string arguments
|
||||
int argIndex = 0;
|
||||
|
||||
boolean useRemaining = false;
|
||||
@ -126,20 +127,24 @@ public class CommandDispatcher {
|
||||
StringBuilder argValue = new StringBuilder();
|
||||
|
||||
if (useRemaining) {
|
||||
// Argument is supposed to take the rest of the command input
|
||||
for (int i = argIndex; i < args.length; i++) {
|
||||
final String arg = args[i];
|
||||
if (argValue.length() > 0)
|
||||
argValue.append(" ");
|
||||
argValue.append(arg);
|
||||
}
|
||||
final boolean hasArgs = args.length > argIndex;
|
||||
// Verify if there is any string part available
|
||||
if (hasArgs) {
|
||||
// Argument is supposed to take the rest of the command input
|
||||
for (int i = argIndex; i < args.length; i++) {
|
||||
final String arg = args[i];
|
||||
if (argValue.length() > 0)
|
||||
argValue.append(" ");
|
||||
argValue.append(arg);
|
||||
}
|
||||
|
||||
final String argValueString = argValue.toString();
|
||||
final String argValueString = argValue.toString();
|
||||
|
||||
correctionResult = argument.getCorrectionResult(argValueString);
|
||||
if (correctionResult == Argument.SUCCESS) {
|
||||
correct = true;
|
||||
argsValues[argIndex] = argValueString;
|
||||
correctionResult = argument.getCorrectionResult(argValueString);
|
||||
if (correctionResult == Argument.SUCCESS) {
|
||||
correct = true;
|
||||
argsValues[argIndex] = argValueString;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Argument is either single-word or can accept optional delimited space(s)
|
||||
|
Loading…
Reference in New Issue
Block a user