Class ArgumentTypes

java.lang.Object
io.papermc.paper.command.brigadier.argument.ArgumentTypes

@Experimental @NullMarked public final class ArgumentTypes extends Object
Vanilla Minecraft includes several custom ArgumentTypes 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 Details

    • entity

      public static com.mojang.brigadier.arguments.ArgumentType<EntitySelectorArgumentResolver> entity()
      Represents a selector that can capture any single entity.
      Returns:
      argument that takes one entity
    • entities

      public static com.mojang.brigadier.arguments.ArgumentType<EntitySelectorArgumentResolver> entities()
      Represents a selector that can capture multiple entities.
      Returns:
      argument that takes multiple entities
    • player

      public static com.mojang.brigadier.arguments.ArgumentType<PlayerSelectorArgumentResolver> player()
      Represents a selector that can capture a singular player entity.
      Returns:
      argument that takes one player
    • players

      public static com.mojang.brigadier.arguments.ArgumentType<PlayerSelectorArgumentResolver> players()
      Represents a selector that can capture multiple player entities.
      Returns:
      argument that takes multiple players
    • playerProfiles

      public static com.mojang.brigadier.arguments.ArgumentType<PlayerProfileListResolver> playerProfiles()
      A selector argument that provides a list of player profiles.
      Returns:
      player profile argument
    • blockPosition

      public static com.mojang.brigadier.arguments.ArgumentType<BlockPositionResolver> blockPosition()
      A block position argument.
      Returns:
      block position argument
    • finePosition

      public static com.mojang.brigadier.arguments.ArgumentType<FinePositionResolver> finePosition()
      A fine position argument.
      Returns:
      fine position argument
      See Also:
    • finePosition

      public static com.mojang.brigadier.arguments.ArgumentType<FinePositionResolver> finePosition(boolean centerIntegers)
      A fine position argument.
      Parameters:
      centerIntegers - if whole numbers should be centered (+0.5)
      Returns:
      fine position argument
    • blockState

      public static 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

      public static com.mojang.brigadier.arguments.ArgumentType<ItemStack> itemStack()
      An ItemStack argument which provides rich parsing for specifying item material and item NBT information.
      Returns:
      argument
    • itemPredicate

      public static com.mojang.brigadier.arguments.ArgumentType<ItemStackPredicate> itemPredicate()
      An item predicate argument.
      Returns:
      argument
    • namedColor

      public static com.mojang.brigadier.arguments.ArgumentType<NamedTextColor> namedColor()
      An argument for parsing NamedTextColors.
      Returns:
      argument
    • component

      public static com.mojang.brigadier.arguments.ArgumentType<Component> component()
      A component argument.
      Returns:
      argument
    • style

      public static com.mojang.brigadier.arguments.ArgumentType<Style> style()
      A style argument.
      Returns:
      argument
    • signedMessage

      public static 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

      public static com.mojang.brigadier.arguments.ArgumentType<DisplaySlot> scoreboardDisplaySlot()
      A scoreboard display slot argument.
      Returns:
      argument
    • namespacedKey

      public static com.mojang.brigadier.arguments.ArgumentType<NamespacedKey> namespacedKey()
      A namespaced key argument.
      Returns:
      argument
    • key

      public static com.mojang.brigadier.arguments.ArgumentType<Key> key()
      A key argument.
      Returns:
      argument
    • integerRange

      public static com.mojang.brigadier.arguments.ArgumentType<IntegerRangeProvider> integerRange()
      An inclusive range of integers that may be unbounded on either end.
      Returns:
      argument
    • doubleRange

      public static com.mojang.brigadier.arguments.ArgumentType<DoubleRangeProvider> doubleRange()
      An inclusive range of doubles that may be unbounded on either end.
      Returns:
      argument
    • world

      public static com.mojang.brigadier.arguments.ArgumentType<World> world()
      A world argument.
      Returns:
      argument
    • gameMode

      public static com.mojang.brigadier.arguments.ArgumentType<GameMode> gameMode()
      A game mode argument.
      Returns:
      argument
    • heightMap

      public static com.mojang.brigadier.arguments.ArgumentType<HeightMap> heightMap()
      An argument for getting a heightmap type.
      Returns:
      argument
    • uuid

      public static com.mojang.brigadier.arguments.ArgumentType<UUID> uuid()
      A uuid argument.
      Returns:
      argument
    • objectiveCriteria

      public static com.mojang.brigadier.arguments.ArgumentType<Criteria> objectiveCriteria()
      An objective criteria argument
      Returns:
      argument
    • entityAnchor

      public static com.mojang.brigadier.arguments.ArgumentType<LookAnchor> entityAnchor()
      An entity anchor argument.
      Returns:
      argument
    • time

      public static com.mojang.brigadier.arguments.ArgumentType<Integer> time()
      A time argument, returning the number of ticks.

      Examples:

      • "1d"
      • "5s"
      • "2"
      • "6t"
      Returns:
      argument
    • time

      public static 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

      public static com.mojang.brigadier.arguments.ArgumentType<Mirror> templateMirror()
      A template mirror argument
      Returns:
      argument
      See Also:
    • templateRotation

      public static com.mojang.brigadier.arguments.ArgumentType<StructureRotation> templateRotation()
      A template rotation argument.
      Returns:
      argument
      See Also:
    • resource

      public static <T> com.mojang.brigadier.arguments.ArgumentType<T> resource(RegistryKey<T> registryKey)
      An argument for a resource in a Registry.
      Type Parameters:
      T - the registry value type
      Parameters:
      registryKey - the registry's key
      Returns:
      argument
    • resourceKey

      public static <T> com.mojang.brigadier.arguments.ArgumentType<TypedKey<T>> resourceKey(RegistryKey<T> registryKey)
      An argument for a typed key for a Registry.
      Type Parameters:
      T - the registry value type
      Parameters:
      registryKey - the registry's key
      Returns:
      argument
      See Also: