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[]Splits raw command input into 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
-
splitArgs
Splits raw command input into arguments, dropping the leading command label when present.- Parameters:
input- the raw input linerootName- the root command name, used to recognise an explicit label- Returns:
- the command arguments
-