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.

@FunctionalInterface @API(status=STABLE) public interface BlockingSuggestionProvider<C> extends SuggestionProvider<C>
Specialized variant of 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.

  • Method Details

    • suggestions

      Returns the suggestions for the given input.

      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.

      Parameters:
      context - the context of the suggestion lookup
      input - 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: SuggestionProvider
      Returns a future that completes with the suggestions for the given input.

      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.

      Specified by:
      suggestionsFuture in interface SuggestionProvider<C>
      Parameters:
      context - the context of the suggestion lookup
      input - the current input
      Returns:
      the suggestions