AdditionalArgs

data class AdditionalArgs(val instance: JavaPlugin, val keys: List<Pair<String, PersistentDataType<*, *>>>)

Declares the extra, per-instance parameters an item/entity accepts (e.g. via /egive item <arg>).

keys is the schema: an ordered list of name to PersistentDataType pairs. Each pair says what the parameter is called (the String — used to build its NamespacedKey(instance, name)) and what type it holds (the PersistentDataType — how the raw string is parsed and stored). The order matters: positional command/createItemStack arguments are matched to keys in this order.

Build it with Kotlin's to and the standard PersistentDataType constants:

AdditionalArgs(
ExamplePlugin.instance,
listOf(
"radius" to PersistentDataType.INTEGER, // /egive example 5
"owner" to PersistentDataType.STRING, // /egive example 5 Steve
)
)

Supported types are the scalar PDC constants (STRING, INTEGER, LONG, DOUBLE, FLOAT, BYTE, SHORT, BOOLEAN) and the comma-separated arrays (BYTE_ARRAY, INTEGER_ARRAY, LONG_ARRAY).

Constructors

Link copied to clipboard
constructor(instance: JavaPlugin, keys: List<Pair<String, PersistentDataType<*, *>>>)

Properties

Link copied to clipboard
val instance: JavaPlugin

owning plugin (namespaces the keys)

Link copied to clipboard
val keys: List<Pair<String, PersistentDataType<*, *>>>

ordered name to PersistentDataType schema; arguments are parsed positionally in this order