PersistentCompound

abstract class PersistentCompound(source)

Holds data which can be accessed fast because it is stored in memory. Additionally, the data will be stored persistently to the disk, if the game decides to do so.

Inheritors

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun clear()

Clears all persistent data from this compound.

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

Tries to get the value for the given key and convert it to the given type T.

Link copied to clipboard
inline fun <T : Any> getAndRemove(key: CompoundKey<T>): T?

Removes the current value associated with the given key. Additionally, this function returns the value that was removed, if one was removed. Otherwise, the return value will be null.

Link copied to clipboard
inline fun <T : Any> getOrPut(key: CompoundKey<T>, defaultValue: () -> T): T

Executes the get function. If the result of the get function is null the defaultValue will be evaluated and put into the compound.

Link copied to clipboard
inline operator fun <T : Any> minusAssign(key: CompoundKey<T>)

Removes the current value associated with the given key.

Link copied to clipboard
fun remove(key: CompoundKey<*>)

Removes the current value associated with the given key.

Link copied to clipboard
operator fun <T : Any> set(key: CompoundKey<T>, value: T)

Puts the given value into the persistent storage.