Strings should only consume rest when they are the last parameter

This fixes a brigadier issue with strings being automatically greedy
This commit is contained in:
chickeneer
2022-07-31 10:08:24 -05:00
parent 348f8fb4c9
commit c35e45477e
@@ -101,7 +101,7 @@ public class CommandParameter<CEC extends CommandExecutionContext<CEC, ? extends
//noinspection unchecked
this.commandIssuer = paramIndex == 0 && manager.isCommandIssuer(type);
this.canConsumeInput = !this.commandIssuer && !(resolver instanceof IssuerOnlyContextResolver);
this.consumesRest = (type == String.class && !annotations.hasAnnotation(param, Single.class)) || (isLast && type == String[].class);
this.consumesRest = isLast && ((type == String.class && !annotations.hasAnnotation(param, Single.class)) || (type == String[].class));
this.values = annotations.getAnnotationValues(param, Values.class, Annotations.REPLACEMENTS | Annotations.NO_EMPTY);