Class PaperSuggestions
java.lang.Object
io.github.projectunified.craftcommand.paper.PaperSuggestions
Brigadier suggestion support shared by every generated Paper command wrapper.
Keeping the input handling here means a generated wrapper only states which provider answers for an argument, instead of repeating the argument splitting and filtering for every command.
-
Method Summary
Modifier and TypeMethodDescriptionstatic String[]arguments(com.mojang.brigadier.context.CommandContext<io.papermc.paper.command.brigadier.CommandSourceStack> ctx) The parsed command arguments, dropping the leading command label when present.static CompletableFuture<com.mojang.brigadier.suggestion.Suggestions> suggestMatching(com.mojang.brigadier.context.CommandContext<io.papermc.paper.command.brigadier.CommandSourceStack> ctx, com.mojang.brigadier.suggestion.SuggestionsBuilder builder, Function<String[], Collection<String>> provider) Completes the argument the sender is currently typing from a suggestion provider.
-
Method Details
-
suggestMatching
public static CompletableFuture<com.mojang.brigadier.suggestion.Suggestions> suggestMatching(com.mojang.brigadier.context.CommandContext<io.papermc.paper.command.brigadier.CommandSourceStack> ctx, com.mojang.brigadier.suggestion.SuggestionsBuilder builder, Function<String[], Collection<String>> provider) Completes the argument the sender is currently typing from a suggestion provider.- Parameters:
ctx- the Brigadier command contextbuilder- the suggestions builder holding the remaining inputprovider- supplies the candidate suggestions for the parsed arguments- Returns:
- the suggestions for the current input
-
arguments
public static String[] arguments(com.mojang.brigadier.context.CommandContext<io.papermc.paper.command.brigadier.CommandSourceStack> ctx) The parsed command arguments, dropping the leading command label when present.- Parameters:
ctx- the Brigadier command context- Returns:
- the command arguments
-