mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
ParametricCallable.mayConsumeArguments() handles flags better.
This commit is contained in:
parent
06c248e518
commit
765d987ae1
@ -345,7 +345,10 @@ class ParametricCallable implements CommandCallable {
|
|||||||
// - Before required parameters: Consume if there are 'left over' args
|
// - Before required parameters: Consume if there are 'left over' args
|
||||||
// - At the end: Always consumes
|
// - At the end: Always consumes
|
||||||
|
|
||||||
if (parameter.isOptional() && parameter.getFlag() == null) {
|
if (parameter.isOptional()) {
|
||||||
|
if (parameter.getFlag() != null) {
|
||||||
|
return !parameter.isValueFlag() || context.hasFlag(parameter.getFlag());
|
||||||
|
} else {
|
||||||
int numberFree = context.argsLength() - scoped.position();
|
int numberFree = context.argsLength() - scoped.position();
|
||||||
for (int j = i; j < parameters.length; j++) {
|
for (int j = i; j < parameters.length; j++) {
|
||||||
if (parameters[j].isNonFlagConsumer() && !parameters[j].isOptional()) {
|
if (parameters[j].isNonFlagConsumer() && !parameters[j].isOptional()) {
|
||||||
@ -360,6 +363,7 @@ class ParametricCallable implements CommandCallable {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user