argument
Adds a new argument to this command. This variant of the argument function allows you to specify the ArgumentType in the classical Brigadier way.
Parameters
the name of the argument - This will be displayed to the player, if there is enough room for the tooltip.
the type of the argument - There are predefined types like StringArgumentType.string()
or IdentifierArgumentType.identifier()
. You can also pass a lambda, as ArgumentType is a functional interface. For simple types, consider using the inline reified
version of this function instead.
Adds a new argument to this command. This variant of the argument function allows you to pass and argument which depends on the CommandBuildContext.
Parameters
the name of the argument - This will be displayed to the player, if there is enough room for the tooltip.
the provider for the ArgumentType - there are predefined types like BlockStateArgument.block(context)
and ItemArgument.item(context)
or you can pass your own
Adds a new argument to this command. This variant of the argument function you to specifiy the argument parse logic using a Kotlin lambda function (parser).
Parameters
the name of the argument - This will be displayed to the player, if there is enough room for the tooltip.
gives you a StringReader, which allows you to parse the input of the user - you should return a value of the given type T, which will be the argument value
Adds a new argument to this command. The ArgumentType will be resolved using the reified type T. For a list of supported types, have a look at ArgumentTypeUtils.fromReifiedType, as it is the function used by this builder function.
Parameters
the name of the argument - This will be displayed to the player, if there is enough room for the tooltip.