mirror of
https://github.com/Minestom/Minestom.git
synced 2024-07-01 08:54:57 +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];
|
final String[] argsValues = new String[arguments.length];
|
||||||
|
|
||||||
boolean syntaxCorrect = true;
|
boolean syntaxCorrect = true;
|
||||||
|
// The current index in the raw command string arguments
|
||||||
int argIndex = 0;
|
int argIndex = 0;
|
||||||
|
|
||||||
boolean useRemaining = false;
|
boolean useRemaining = false;
|
||||||
|
@ -126,20 +127,24 @@ public class CommandDispatcher {
|
||||||
StringBuilder argValue = new StringBuilder();
|
StringBuilder argValue = new StringBuilder();
|
||||||
|
|
||||||
if (useRemaining) {
|
if (useRemaining) {
|
||||||
// Argument is supposed to take the rest of the command input
|
final boolean hasArgs = args.length > argIndex;
|
||||||
for (int i = argIndex; i < args.length; i++) {
|
// Verify if there is any string part available
|
||||||
final String arg = args[i];
|
if (hasArgs) {
|
||||||
if (argValue.length() > 0)
|
// Argument is supposed to take the rest of the command input
|
||||||
argValue.append(" ");
|
for (int i = argIndex; i < args.length; i++) {
|
||||||
argValue.append(arg);
|
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);
|
correctionResult = argument.getCorrectionResult(argValueString);
|
||||||
if (correctionResult == Argument.SUCCESS) {
|
if (correctionResult == Argument.SUCCESS) {
|
||||||
correct = true;
|
correct = true;
|
||||||
argsValues[argIndex] = argValueString;
|
argsValues[argIndex] = argValueString;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Argument is either single-word or can accept optional delimited space(s)
|
// Argument is either single-word or can accept optional delimited space(s)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user