Class PaperSuggestions

java.lang.Object
io.github.projectunified.craftcommand.paper.PaperSuggestions

public final class PaperSuggestions extends Object
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 Type
    Method
    Description
    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.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 context
      builder - the suggestions builder holding the remaining input
      provider - 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