Class ScriptSuggestionProvider

java.lang.Object
org.skriptlang.skript.bukkit.command.elements.structures.util.ScriptSuggestionProvider

@Internal public class ScriptSuggestionProvider extends Object
Utility class for managing ScriptBrigadierCommand suggestions. Similar to SuggestionProvider.
  • Constructor Details

    • ScriptSuggestionProvider

      public ScriptSuggestionProvider(List<ArgumentData<?>> arguments, Trigger suggestionsProvider)
      Parameters:
      suggestionsProvider - A trigger to execute using CommandSuggestionEvent. It is expected (though not required) that this trigger holds code to modify suggestions.
  • Method Details

    • getSuggestions

      public CompletableFuture<com.mojang.brigadier.suggestion.Suggestions> getSuggestions(ArgumentData<?> argumentData, com.mojang.brigadier.arguments.ArgumentType<?> argument, com.mojang.brigadier.context.CommandContext<io.papermc.paper.command.brigadier.CommandSourceStack> context, com.mojang.brigadier.suggestion.SuggestionsBuilder builder)
      Obtains suggestions for a specific argument using this provider.
      Parameters:
      argumentData - Data about the argument suggestions are being obtained for.
      argument - The underlying argument suggestions are being obtained for.
      context - Context around the command execution.
      builder - The builder to add suggestions to.
      Returns:
      Future to obtain suggestions.
    • suggest

      public static void suggest(@NotNull @NotNull com.mojang.brigadier.suggestion.SuggestionsBuilder builder, CommandSuggestionEvent.CommandSuggestion suggestion, ScriptSuggestionProvider.FilteringMode filteringMode)
      Attempts to add suggestion to builder. It expects that suggestion starts with (ignoring case) the currently entered input for the argument.
      Parameters:
      builder - The builder to add the suggestion to.
      suggestion - The suggestion.