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,6 +127,9 @@ public class CommandDispatcher {
|
||||
StringBuilder argValue = new StringBuilder();
|
||||
|
||||
if (useRemaining) {
|
||||
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];
|
||||
@ -141,6 +145,7 @@ public class CommandDispatcher {
|
||||
correct = true;
|
||||
argsValues[argIndex] = argValueString;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Argument is either single-word or can accept optional delimited space(s)
|
||||
for (int i = argIndex; i < args.length; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user