getAdditionalArgs

open override fun getAdditionalArgs(): AdditionalArgs?

Declares extra, per-stack parameters this item accepts — values baked into an individual stack's persistent data at creation time, so two stacks of the same item can carry different settings (e.g. a "radius" or "power" tuned per stack).

Override this to declare the parameters (each an ordered name → PDC type pair). They are then:

  • supplied positionally when the stack is created — createItemStack(amount, listOf("5", "true")), or via the built-in /egive <item> <arg1> <arg2> … command (parsed in declared order);

  • read back with additionalKey + EffectiveDataContainerUtils, typically inside a behaviour;

  • optionally shown in the lore when showAdditionArgsInLore returns true.

override fun getAdditionalArgs() = AdditionalArgs(
ExamplePlugin.instance,
listOf("radius" to PersistentDataType.INTEGER)
)
override fun showAdditionArgsInLore() = true

// reading the value from a created stack:
val radius = EffectiveDataContainerUtils.getContainerValue(
stack, additionalKey("radius"), PersistentDataType.INTEGER
)

Returns null (the default) for items without extra parameters. Supported types are the primitive PDC types and their comma-separated arrays.