Class StringArrayArgument.StringArrayParser<C>
- Type Parameters:
C
- Command sender type
- All Implemented Interfaces:
ArgumentParser<C,
String[]>
- Enclosing class:
- StringArrayArgument<C>
-
Field Summary
Fields inherited from interface cloud.commandframework.arguments.parser.ArgumentParser
DEFAULT_ARGUMENT_COUNT
-
Constructor Summary
ConstructorDescriptionConstruct a new string array parser.StringArrayParser
(boolean flagYielding) Construct a new string array parser. -
Method Summary
Modifier and TypeMethodDescription@NonNull ArgumentParseResult<String @NonNull []>
parse
(@NonNull CommandContext<@NonNull C> commandContext, @NonNull Queue<@NonNull String> inputQueue) Parse command input into a command result.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface cloud.commandframework.arguments.parser.ArgumentParser
getRequestedArgumentCount, isContextFree, map, suggestions
-
Constructor Details
-
StringArrayParser
public StringArrayParser()Construct a new string array parser. -
StringArrayParser
@API(status=STABLE, since="1.7.0") public StringArrayParser(boolean flagYielding) Construct a new string array parser.- Parameters:
flagYielding
- Whether the parser should stop parsing when encountering a potential flag- Since:
- 1.7.0
-
-
Method Details
-
parse
public @NonNull ArgumentParseResult<String @NonNull []> parse(@NonNull CommandContext<@NonNull C> commandContext, @NonNull Queue<@NonNull String> inputQueue) Description copied from interface:ArgumentParser
Parse command input into a command result.This method may be called when a command chain is being parsed for execution (using
CommandManager.executeCommand(Object, String)
) or when a command is being parsed to provide context for suggestions (usingCommandManager.suggest(Object, String)
). It is possible to useCommandContext.isSuggestions()
} to see what the purpose of the parsing is. Particular care should be taken when parsing for suggestions, as the parsing method is then likely to be called once for every character written by the command sender.This method should never throw any exceptions under normal circumstances. Instead, if the parsing for some reason cannot be done successfully
ArgumentParseResult.failure(Throwable)
should be returned. This then wraps any exception that should be forwarded to the command sender.The parser is assumed to be completely stateless and should not store any information about the command sender or the command context. Instead, information should be stored in the
CommandContext
.- Specified by:
parse
in interfaceArgumentParser<C,
String[]> - Parameters:
commandContext
- Command contextinputQueue
- The queue of arguments- Returns:
- Parsed command result
-