Class ScriptSuggestionProvider
java.lang.Object
org.skriptlang.skript.bukkit.command.elements.structures.util.ScriptSuggestionProvider
Utility class for managing
ScriptBrigadierCommand suggestions.
Similar to SuggestionProvider.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumModes for filtering suggestions based on context. -
Constructor Summary
ConstructorsConstructorDescriptionScriptSuggestionProvider(List<ArgumentData<?>> arguments, Trigger suggestionsProvider) -
Method Summary
Modifier and TypeMethodDescriptionCompletableFuture<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.static voidsuggest(@NotNull com.mojang.brigadier.suggestion.SuggestionsBuilder builder, CommandSuggestionEvent.CommandSuggestion suggestion, ScriptSuggestionProvider.FilteringMode filteringMode) Attempts to addsuggestiontobuilder.
-
Constructor Details
-
ScriptSuggestionProvider
- Parameters:
suggestionsProvider- A trigger to execute usingCommandSuggestionEvent. 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 addsuggestiontobuilder. It expects thatsuggestionstarts with (ignoring case) the currently entered input for the argument.- Parameters:
builder- The builder to add the suggestion to.suggestion- The suggestion.
-