PersistentDataEditor

A DSL interface for reading and writing persistent data on an entity's PersistentDataContainer.

Provides operator overloads for a more idiomatic Kotlin experience when working with Bukkit's persistent data API.

Properties

Link copied to clipboard
abstract val origin: PersistentDataContainer

The underlying PersistentDataContainer being edited.

Functions

Link copied to clipboard
open operator fun contains(key: NamespacedKey): Boolean

Operator alias for has.

Link copied to clipboard
inline operator fun <T : Any> PersistentDataEditor.get(key: NamespacedKey): T?

Retrieves a value from the container using the inferred type T.

Link copied to clipboard
abstract fun has(key: NamespacedKey): Boolean

Returns true if the container has a value associated with the given key.

Link copied to clipboard
abstract fun remove(key: NamespacedKey)

Removes the value associated with the given key from the container.

Link copied to clipboard
abstract operator fun <T : Any> set(key: NamespacedKey, data: PersistentDataType<T, T>, value: T)

Sets a value in the container with an explicit PersistentDataType.

Link copied to clipboard
inline operator fun <T : Any> PersistentDataEditor.set(key: NamespacedKey, value: T)

Stores a value in the container using the inferred type T.