Fix incorrect inputQueue usage in some argument types

This commit is contained in:
Jason Penilla 2022-01-06 11:51:26 -08:00 committed by Jason
parent 33c51967e2
commit c26fbcb6fc
8 changed files with 13 additions and 7 deletions

View file

@ -181,14 +181,15 @@ public final class BooleanArgument<C> extends CommandArgument<C, Boolean> {
commandContext
));
}
inputQueue.remove();
if (!this.liberal) {
if (input.equalsIgnoreCase("true")) {
inputQueue.remove();
return ArgumentParseResult.success(true);
}
if (input.equalsIgnoreCase("false")) {
inputQueue.remove();
return ArgumentParseResult.success(false);
}
@ -198,10 +199,12 @@ public final class BooleanArgument<C> extends CommandArgument<C, Boolean> {
final String uppercaseInput = input.toUpperCase();
if (LIBERAL_TRUE.contains(uppercaseInput)) {
inputQueue.remove();
return ArgumentParseResult.success(true);
}
if (LIBERAL_FALSE.contains(uppercaseInput)) {
inputQueue.remove();
return ArgumentParseResult.success(false);
}

View file

@ -141,6 +141,7 @@ public final class CharArgument<C> extends CommandArgument<C, Character> {
return ArgumentParseResult.failure(new CharParseException(input, commandContext));
}
inputQueue.remove();
return ArgumentParseResult.success(input.charAt(0));
}