Improve handling of non-quoted strings in quoted string parser

This commit is contained in:
Jason Penilla 2021-07-04 20:57:56 -07:00 committed by Jason
parent 75e59c9fe6
commit 490bdfa3a4

View file

@ -321,6 +321,12 @@ public final class StringArgument<C> extends CommandArgument<C, String> {
final @NonNull CommandContext<C> commandContext,
final @NonNull Queue<@NonNull String> inputQueue
) {
final String peek = inputQueue.peek();
if (peek != null && !peek.startsWith("'") && !peek.startsWith("\"")) {
inputQueue.remove();
return ArgumentParseResult.success(peek);
}
final StringJoiner sj = new StringJoiner(" ");
for (final String string : inputQueue) {
sj.add(string);