Class PlayerArgumentType

java.lang.Object
net.uku3lig.ukulib.utils.PlayerArgumentType
All Implemented Interfaces:
com.mojang.brigadier.arguments.ArgumentType<PlayerArgumentType.PlayerSelector>

public class PlayerArgumentType extends Object implements com.mojang.brigadier.arguments.ArgumentType<PlayerArgumentType.PlayerSelector>
An argument type which represents players. Can only be used in client commands.
  • Field Details

    • PLAYER_NOT_FOUND_EXCEPTION

      public static final com.mojang.brigadier.exceptions.SimpleCommandExceptionType PLAYER_NOT_FOUND_EXCEPTION
      The exception thrown when the selected player is not found.
  • Method Details

    • player

      public static PlayerArgumentType player()
      Returns a new instance.
      Returns:
      The instance
    • getPlayer

      public static <S> net.minecraft.world.entity.player.Player getPlayer(String name, com.mojang.brigadier.context.CommandContext<S> context) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Gets the player passed to the command.
      Type Parameters:
      S - The command context source type
      Parameters:
      name - The name of the argument
      context - The command context
      Returns:
      The player entity
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException - if the player is not found
    • parse

      public PlayerArgumentType.PlayerSelector parse(com.mojang.brigadier.StringReader reader) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Specified by:
      parse in interface com.mojang.brigadier.arguments.ArgumentType<PlayerArgumentType.PlayerSelector>
      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<PlayerArgumentType.PlayerSelector>
    • getExamples

      public Collection<String> getExamples()
      Specified by:
      getExamples in interface com.mojang.brigadier.arguments.ArgumentType<PlayerArgumentType.PlayerSelector>