Class PlayerListArgument

java.lang.Object
net.kamkeyke.raccooncore.command.argumenttype.PlayerListArgument
All Implemented Interfaces:
com.mojang.brigadier.arguments.ArgumentType<List<String>>

public class PlayerListArgument extends Object implements com.mojang.brigadier.arguments.ArgumentType<List<String>>
Custom argument type for commands that allows the selection of multiple player names in a formatted list enclosed in curly braces. Makes it easier to pass multiple players as arguments.

Expected format: {player1,player2,player3...}

This class handles the parsing of the input string and provides real-time tab-completion suggestions, filtering online player names after each comma or at the start of the list.

See Also:
  • ArgumentType
  • Constructor Details

    • PlayerListArgument

      public PlayerListArgument()
  • Method Details

    • players

      public static PlayerListArgument players()
    • getPlayerList

      public static List<String> getPlayerList(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, String name)
    • parse

      public List<String> parse(com.mojang.brigadier.StringReader stringReader) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Specified by:
      parse in interface com.mojang.brigadier.arguments.ArgumentType<List<String>>
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • listSuggestions

      public <S> CompletableFuture<com.mojang.brigadier.suggestion.Suggestions> listSuggestions(com.mojang.brigadier.context.CommandContext<S> context, com.mojang.brigadier.suggestion.SuggestionsBuilder builder)
      Specified by:
      listSuggestions in interface com.mojang.brigadier.arguments.ArgumentType<List<String>>