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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordSimple record used to store the player name for later use -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.brigadier.exceptions.SimpleCommandExceptionTypeThe exception thrown when the selected player is not found. -
Method Summary
Modifier and TypeMethodDescriptionstatic <S> net.minecraft.world.entity.player.PlayerGets the player passed to the command.<S> CompletableFuture<com.mojang.brigadier.suggestion.Suggestions> listSuggestions(com.mojang.brigadier.context.CommandContext<S> context, com.mojang.brigadier.suggestion.SuggestionsBuilder builder) parse(com.mojang.brigadier.StringReader reader) static PlayerArgumentTypeplayer()Returns a new instance.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.mojang.brigadier.arguments.ArgumentType
parse
-
Field Details
-
PLAYER_NOT_FOUND_EXCEPTION
public static final com.mojang.brigadier.exceptions.SimpleCommandExceptionType PLAYER_NOT_FOUND_EXCEPTIONThe exception thrown when the selected player is not found.
-
-
Method Details
-
player
-
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 argumentcontext- 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:
parsein interfacecom.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:
listSuggestionsin interfacecom.mojang.brigadier.arguments.ArgumentType<PlayerArgumentType.PlayerSelector>
-
getExamples
- Specified by:
getExamplesin interfacecom.mojang.brigadier.arguments.ArgumentType<PlayerArgumentType.PlayerSelector>
-