Interface AutoCompleter


public interface AutoCompleter
Represents the handler for registering and providing auto-completion suggestions.
  • Method Details

    • registerSuggestion

      AutoCompleter registerSuggestion(@NotNull @NotNull String providerID, @NotNull @NotNull SuggestionProvider provider)
      Registers a SuggestionProvider for the specified ID, for use in commands through the AutoComplete annotation.
      Parameters:
      providerID - The tab suggestion id
      provider - The provider for this suggestion
      Returns:
      This auto-completer
    • registerSuggestion

      AutoCompleter registerSuggestion(@NotNull @NotNull String providerID, @NotNull @NotNull Collection<String> completions)
      Registers static completions for the specified ID, for use in commands through the AutoComplete annotation.
      Parameters:
      providerID - The tab suggestion id
      completions - The static list of suggestion. These will be copied and will no longer be modifiable
      Returns:
      This auto-completer
    • registerSuggestion

      AutoCompleter registerSuggestion(@NotNull @NotNull String providerID, @NotNull @NotNull String... completions)
      Registers static completions for the specified ID, for use in commands through the AutoComplete annotation.
      Parameters:
      providerID - The tab suggestion id
      completions - The static list of suggestion. These will be copied and will no longer be modifiable
      Returns:
      This auto-completer
    • registerParameterSuggestions

      AutoCompleter registerParameterSuggestions(@NotNull @NotNull Class<?> parameterType, @NotNull @NotNull SuggestionProvider provider)
      Registers a SuggestionProvider for a specific parameter type. This way, if the parameter is requested in the command, it will automatically be tab-completed without having to be explicitly defined by an AutoComplete.
      Parameters:
      parameterType - The parameter type to complete
      provider - The tab suggestion provider
      Returns:
      This auto-completer
    • registerParameterSuggestions

      AutoCompleter registerParameterSuggestions(@NotNull @NotNull Class<?> parameterType, @NotNull @NotNull String providerID)
      Registers a SuggestionProvider for a specific parameter type. This way, if the parameter is requested in the command, it will automatically be tab-completed without having to be explicitly defined by an AutoComplete.
      Parameters:
      parameterType - The parameter type to complete
      providerID - The tab suggestion provider id. Must be registered with either registerSuggestion(String, SuggestionProvider) or registerSuggestion(String, String...).
      Returns:
      This auto-completer
    • registerSuggestionFactory

      AutoCompleter registerSuggestionFactory(@NotNull @NotNull SuggestionProviderFactory factory)
      Registers a SuggestionProviderFactory that creates suggestion providers dynamically for parameters. This allows for checking against custom annotations in parameters.
      Parameters:
      factory - Factory to register
      Returns:
      This auto-completer
    • registerSuggestionFactory

      AutoCompleter registerSuggestionFactory(int priority, @NotNull @NotNull SuggestionProviderFactory factory)
      Registers a SuggestionProviderFactory that creates suggestion providers dynamically for parameters. This allows for checking against custom annotations in parameters.
      Parameters:
      priority - The resolver priority. Zero represents the highest.
      factory - Factory to register
      Returns:
      This auto-completer
    • getSuggestionProvider

      SuggestionProvider getSuggestionProvider(@NotNull @NotNull String id)
      Returns the suggestion provider that maps to the specified ID.

      This may return null if no such ID is registered.

      Parameters:
      id - ID to retrieve from
      Returns:
      The provider, or null if none is registered
    • complete

      List<String> complete(@NotNull @NotNull CommandActor actor, @NotNull @NotNull ArgumentStack arguments)
      Generates a list of suggestions for the given actor and argument list
      Parameters:
      actor - Actor to generate for
      arguments - The argument stack. This can contain empty values.
      Returns:
      The suggestions list.
    • complete

      List<String> complete(@NotNull @NotNull CommandActor actor, @NotNull @NotNull String buffer)
      Generates a list of suggestions for the given actor and buffer
      Parameters:
      actor - Actor to generate for
      buffer - The current string input
      Returns:
      The suggestions list.
    • and

      Returns the containing CommandHandler of this auto completer. This will allow for writing fluent and readable code.
      Returns:
      The parent command handler