Class ArgumentTypes
java.lang.Object
io.papermc.paper.command.brigadier.argument.ArgumentTypes
Vanilla Minecraft includes several custom
ArgumentType
s that are recognized by the client.
Many of these argument types include client-side completions and validation, and some include command signing context.
This class allows creating instances of these types for use in plugin commands, with friendly API result types.
CustomArgumentType
is provided for customizing parsing or result types server-side, while sending the vanilla argument type to the client.
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull com.mojang.brigadier.arguments.ArgumentType
<BlockPositionResolver> A block position argument.static @NotNull com.mojang.brigadier.arguments.ArgumentType
<BlockState> A blockstate argument which will provide rich parsing for specifying the specific block variant and then the block entity NBT if applicable.A component argument.static @NotNull com.mojang.brigadier.arguments.ArgumentType
<DoubleRangeProvider> An inclusive range of doubles that may be unbounded on either end.static @NotNull com.mojang.brigadier.arguments.ArgumentType
<EntitySelectorArgumentResolver> entities()
Represents a selector that can capture multiple entities.static @NotNull com.mojang.brigadier.arguments.ArgumentType
<EntitySelectorArgumentResolver> entity()
Represents a selector that can capture any single entity.static @NotNull com.mojang.brigadier.arguments.ArgumentType
<LookAnchor> An entity anchor argument.gameMode()
A game mode argument.A argument for getting a heightmap type.static @NotNull com.mojang.brigadier.arguments.ArgumentType
<IntegerRangeProvider> An inclusive range of integers that may be unbounded on either end.static @NotNull com.mojang.brigadier.arguments.ArgumentType
<ItemStackPredicate> An item predicate argument.An ItemStack argument which provides rich parsing for specifying item material and item NBT information.static @NotNull com.mojang.brigadier.arguments.ArgumentType
<net.kyori.adventure.key.Key> key()
A key argument.static @NotNull com.mojang.brigadier.arguments.ArgumentType
<NamedTextColor> An argument for parsingNamedTextColor
s.static @NotNull com.mojang.brigadier.arguments.ArgumentType
<NamespacedKey> A namespaced key argument.An objective criteria argumentstatic @NotNull com.mojang.brigadier.arguments.ArgumentType
<PlayerSelectorArgumentResolver> player()
Represents a selector that can capture a singular player entity.static @NotNull com.mojang.brigadier.arguments.ArgumentType
<PlayerProfileListResolver> A selector argument that provides a list of player profiles.static @NotNull com.mojang.brigadier.arguments.ArgumentType
<PlayerSelectorArgumentResolver> players()
Represents a selector that can capture multiple player entities.static <T> @NotNull com.mojang.brigadier.arguments.ArgumentType
<T> resource
(@NotNull RegistryKey<T> registryKey) An argument for a resource in aRegistry
.resourceKey
(@NotNull RegistryKey<T> registryKey) An argument for a typed key for aRegistry
.static @NotNull com.mojang.brigadier.arguments.ArgumentType
<DisplaySlot> A scoreboard display slot argument.static @NotNull com.mojang.brigadier.arguments.ArgumentType
<SignedMessageResolver> A signed message argument.style()
A style argument.A template mirror argumentstatic @NotNull com.mojang.brigadier.arguments.ArgumentType
<StructureRotation> A template rotation argument.time()
A time argument, returning the number of ticks.time
(int mintime) A time argument, returning the number of ticks.uuid()
A uuid argument.world()
A world argument.
-
Method Details
-
entity
@NotNull public static @NotNull com.mojang.brigadier.arguments.ArgumentType<EntitySelectorArgumentResolver> entity()Represents a selector that can capture any single entity.- Returns:
- argument that takes one entity
-
entities
@NotNull public static @NotNull com.mojang.brigadier.arguments.ArgumentType<EntitySelectorArgumentResolver> entities()Represents a selector that can capture multiple entities.- Returns:
- argument that takes multiple entities
-
player
@NotNull public static @NotNull com.mojang.brigadier.arguments.ArgumentType<PlayerSelectorArgumentResolver> player()Represents a selector that can capture a singular player entity.- Returns:
- argument that takes one player
-
players
@NotNull public static @NotNull com.mojang.brigadier.arguments.ArgumentType<PlayerSelectorArgumentResolver> players()Represents a selector that can capture multiple player entities.- Returns:
- argument that takes multiple players
-
playerProfiles
@NotNull public static @NotNull com.mojang.brigadier.arguments.ArgumentType<PlayerProfileListResolver> playerProfiles()A selector argument that provides a list of player profiles.- Returns:
- player profile arguments
-
blockPosition
@NotNull public static @NotNull com.mojang.brigadier.arguments.ArgumentType<BlockPositionResolver> blockPosition()A block position argument.- Returns:
- argument
-
blockState
@NotNull public static @NotNull com.mojang.brigadier.arguments.ArgumentType<BlockState> blockState()A blockstate argument which will provide rich parsing for specifying the specific block variant and then the block entity NBT if applicable.- Returns:
- argument
-
itemStack
An ItemStack argument which provides rich parsing for specifying item material and item NBT information.- Returns:
- argument
-
itemPredicate
@NotNull public static @NotNull com.mojang.brigadier.arguments.ArgumentType<ItemStackPredicate> itemPredicate()An item predicate argument.- Returns:
- argument
-
namedColor
@NotNull public static @NotNull com.mojang.brigadier.arguments.ArgumentType<NamedTextColor> namedColor()An argument for parsingNamedTextColor
s.- Returns:
- argument
-
component
A component argument.- Returns:
- argument
-
style
A style argument.- Returns:
- argument
-
signedMessage
@NotNull public static @NotNull com.mojang.brigadier.arguments.ArgumentType<SignedMessageResolver> signedMessage()A signed message argument. This argument can be resolved to retrieve the underlying signed message.- Returns:
- argument
-
scoreboardDisplaySlot
@NotNull public static @NotNull com.mojang.brigadier.arguments.ArgumentType<DisplaySlot> scoreboardDisplaySlot()A scoreboard display slot argument.- Returns:
- argument
-
namespacedKey
@NotNull public static @NotNull com.mojang.brigadier.arguments.ArgumentType<NamespacedKey> namespacedKey()A namespaced key argument.- Returns:
- argument
-
key
@NotNull public static @NotNull com.mojang.brigadier.arguments.ArgumentType<net.kyori.adventure.key.Key> key()A key argument.- Returns:
- argument
-
integerRange
@NotNull public static @NotNull com.mojang.brigadier.arguments.ArgumentType<IntegerRangeProvider> integerRange()An inclusive range of integers that may be unbounded on either end.- Returns:
- argument
-
doubleRange
@NotNull public static @NotNull com.mojang.brigadier.arguments.ArgumentType<DoubleRangeProvider> doubleRange()An inclusive range of doubles that may be unbounded on either end.- Returns:
- argument
-
world
A world argument.- Returns:
- argument
-
gameMode
A game mode argument.- Returns:
- argument
-
heightMap
A argument for getting a heightmap type.- Returns:
- argument
-
uuid
A uuid argument.- Returns:
- argument
-
objectiveCriteria
@NotNull public static @NotNull com.mojang.brigadier.arguments.ArgumentType<Criteria> objectiveCriteria()An objective criteria argument- Returns:
- argument
-
entityAnchor
@NotNull public static @NotNull com.mojang.brigadier.arguments.ArgumentType<LookAnchor> entityAnchor()An entity anchor argument.- Returns:
- argument
-
time
A time argument, returning the number of ticks.Examples:
- "1d"
- "5s"
- "2"
- "6t"
- Returns:
- argument
-
time
@NotNull public static @NotNull com.mojang.brigadier.arguments.ArgumentType<Integer> time(int mintime) A time argument, returning the number of ticks.Examples:
- "1d"
- "5s"
- "2"
- "6t"
- Parameters:
mintime
- The minimum time required for this argument.- Returns:
- argument
-
templateMirror
@NotNull public static @NotNull com.mojang.brigadier.arguments.ArgumentType<Mirror> templateMirror()A template mirror argument- Returns:
- argument
- See Also:
-
templateRotation
@NotNull public static @NotNull com.mojang.brigadier.arguments.ArgumentType<StructureRotation> templateRotation()A template rotation argument.- Returns:
- argument
- See Also:
-
resource
@NotNull public static <T> @NotNull com.mojang.brigadier.arguments.ArgumentType<T> resource(@NotNull @NotNull RegistryKey<T> registryKey) An argument for a resource in aRegistry
.- Type Parameters:
T
- the registry value type- Parameters:
registryKey
- the registry's key- Returns:
- argument
-
resourceKey
@NotNull public static <T> @NotNull com.mojang.brigadier.arguments.ArgumentType<TypedKey<T>> resourceKey(@NotNull @NotNull RegistryKey<T> registryKey) An argument for a typed key for aRegistry
.- Type Parameters:
T
- the registry value type- Parameters:
registryKey
- the registry's key- Returns:
- argument
- See Also:
-