data

fun Entity.data(editor: PersistentDataEditor.() -> Unit)

Edits the persistent data of this entity using a DSL builder.

Example usage:

entity.data {
this[NamespacedKey(plugin, "my_key")] = "hello"
remove(NamespacedKey(plugin, "old_key"))
}

Parameters

editor

a lambda with receiver that reads or writes persistent data