primary
- Returns:
- the primary parser
C - command sender typeU - primary value typeV - fallback value typeArgumentParser<C,Either<U,V>> , ArgumentParser.FutureArgumentParser<C,Either<U,V>> , SuggestionProvider<C>, SuggestionProviderHolder<C>primary() parser and falls back on the fallback() parser if that fails.static final class ArgumentParser.FutureArgumentParser<C,T> EitherParser(@NonNull ParserDescriptor<C,U> primary,
@NonNull ParserDescriptor<C,V> fallback) static <C,
U,
V> ParserDescriptor<C,Either<U,V>> eitherParser(@NonNull ParserDescriptor<C,U> primary,
@NonNull ParserDescriptor<C,V> fallback) primary parser and falls back on
the fallback parser if that fails.fallback()parseFuture(@NonNull CommandContext<@NonNull C> commandContext,
@NonNull CommandInput commandInput) commandInput.primary()@NonNull CompletableFuture<? extends @NonNull Iterable<? extends @NonNull Suggestion>> suggestionsFuture(@NonNull CommandContext<C> context,
@NonNull CommandInput input) input.clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitflatMap, flatMapSuccess, mapSuccess, suggestionProviderparseprimary - primary parserfallback - fallback parser which gets invoked if the primary parser fails to parse the inputprimary parser and falls back on
the fallback parser if that fails.C - command sender typeU - primary value typeV - fallback value typeprimary - primary parserfallback - fallback parser which gets invoked if the primary parser fails to parse the inputArgumentParsercommandInput.
This method may be called when a command chain is being parsed for execution
(using CommandExecutor.executeCommand(Object, String))
or when a command is being parsed to provide context for suggestions
(using SuggestionFactory.suggest(Object, String)).
It is possible to use CommandContext.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)
or ArgumentParseResult.failureFuture(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.
parseFuture in interface ArgumentParser<C,U> parseFuture in interface ArgumentParser.FutureArgumentParser<C,U> commandContext - Command contextcommandInput - Command InputSuggestionProviderinput.
The input parameter contains all sender-provided input that has not yet been consumed by the argument parsers.
If the component that the suggestion provider is generating suggestions for consumes multiple tokens the suggestion
provider might receive a CommandInput instance containing multiple tokens.
CommandInput.lastRemainingToken() may be used to extract the part of the command that is currently being
completed by the command sender.
If you don't need to return a future, you can implement BlockingSuggestionProvider instead.
suggestionsFuture in interface SuggestionProvider<C>context - the context of the suggestion lookupinput - the current input