Interface BlockingSuggestionProvider<C>
- Type Parameters:
C- command sender type
- All Superinterfaces:
SuggestionProvider<C>
- All Known Subinterfaces:
BlockingSuggestionProvider.Strings<C>
- All Known Implementing Classes:
BooleanParser,ByteParser,DurationParser,EnumParser,IntegerParser,LiteralParser,LongParser,ShortParser
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
SuggestionProvider that does work on the calling thread.
In the case that a specific thread context isn't required, this is usually simpler
to implement than SuggestionProvider.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceSpecialized variant ofBlockingSuggestionProviderthat hasStringresults instead ofSuggestionresults. -
Method Summary
Modifier and TypeMethodDescription@NonNull Iterable<? extends @NonNull Suggestion> suggestions(@NonNull CommandContext<C> context, @NonNull CommandInput input) Returns the suggestions for the giveninput.default @NonNull CompletableFuture<? extends @NonNull Iterable<? extends @NonNull Suggestion>> suggestionsFuture(@NonNull CommandContext<C> context, @NonNull CommandInput input) Returns a future that completes with the suggestions for the giveninput.
-
Method Details
-
suggestions
@NonNull Iterable<? extends @NonNull Suggestion> suggestions(@NonNull CommandContext<C> context, @NonNull CommandInput input) Returns the suggestions for the giveninput.The
inputparameter 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 aCommandInputinstance containing multiple tokens.CommandInput.lastRemainingToken()may be used to extract the part of the command that is currently being completed by the command sender.- Parameters:
context- the context of the suggestion lookupinput- the current input- Returns:
- the suggestions
-
suggestionsFuture
default @NonNull CompletableFuture<? extends @NonNull Iterable<? extends @NonNull Suggestion>> suggestionsFuture(@NonNull CommandContext<C> context, @NonNull CommandInput input) Description copied from interface:SuggestionProviderReturns a future that completes with the suggestions for the giveninput.The
inputparameter 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 aCommandInputinstance 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
BlockingSuggestionProviderinstead.- Specified by:
suggestionsFuturein interfaceSuggestionProvider<C>- Parameters:
context- the context of the suggestion lookupinput- the current input- Returns:
- the suggestions
-