persistentData

inline fun <T> persistentData(key: NamespacedKey, type: PersistentDataType<*, T & Any>, crossinline default: () -> T): ReadWriteProperty<PersistentDataHolder, T>(source)

Acts as a property delegate for stuff contained inside a PersistentDataContainer For example:

val numberOfTimesJumped: Int by persistentData(NamespacedKey(yourPlugin, "jumped"), PersistentDataType.INTEGER) { 0 }

Same as persistentData but with a default value that is constant