EmptyPersistentDataContainer

An immutable implementation of PersistentDataContainer and BufferedPersistentDataContainer that does not store any data.

This container always returns null or false for any retrieval or existence checks, and reports its size as 0. It behaves as an empty container, making it useful as a default or placeholder implementation.

Since this implementation is immutable, methods for modifying the buffer or data storage have no effect. Any attempts to save data or iterate over the keys will operate as if the container is completely empty.

This class guarantees:

  • isEmpty() always returns true

  • size is always 0

  • No data is ever held or retained

Use this class when no persistent or buffered data management is required, but an implementation of PersistentDataContainer or BufferedPersistentDataContainer is needed.

Properties

Link copied to clipboard
open override val size: Int = 0

Functions

Link copied to clipboard
@JvmName(name = "create")
fun <P : Any, C : Any> PersistentDataContainer.bound(key: String, type: PersistentDataType<P, C>): BoundEntry<P, C>

Creates a bound entry for accessing persistent data within the container.

@JvmName(name = "create")
fun <P : Any, C : Any> PersistentDataContainer.bound(key: String, type: PersistentDataType<P, C>, default: () -> C): DefaultBoundEntry<P, C>

Creates a DefaultBoundEntry that is bound to the specified PersistentDataContainer. This entry allows the retrieval of a value using the specified key and type, with the capability to provide a default value if the key does not exist in the container.

Link copied to clipboard
open override fun clearBuffer()

Clears the buffer.

Link copied to clipboard
open operator override fun contains(element: String): Boolean

open override fun <P : Any, C : Any> contains(key: String, type: PersistentDataType<P, C>): Boolean

Checks if the container contains a value associated with the specified key.

Link copied to clipboard

Checks if the container contains a value associated with the specified PersistentKey.

Link copied to clipboard
open override fun containsAll(elements: Collection<String>): Boolean
Link copied to clipboard

This methode copies all key-value pairs from the PersistentDataContainer to the receiver.

Link copied to clipboard
open override fun deleteBuffer(key: String)

Deletes the buffer with the given key.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open operator override fun <P : Any, C : Any> get(key: String, type: PersistentDataType<P, C>): C?

Gets the value associated with the specified key.

Link copied to clipboard
operator fun <P : Any, C : Any> PersistentDataContainer.get(key: PersistentKey<P, C>): C?

Retrieves the value associated with the specified key from the persistent data container.

Link copied to clipboard

This methode is used to get the direct value of the key.

Link copied to clipboard

This method is used to get the value of the specified key from the PersistentDataContainer.

Link copied to clipboard
fun <P : Any, C : Any> PersistentDataContainer.getOrDefault(key: String, type: PersistentDataType<P, C>, default: C): C
fun <P : Any, C : Any> PersistentDataContainer.getOrDefault(key: String, type: PersistentDataType<P, C>, default: () -> C): C

This method is used to get the value of the specified key from the PersistentDataContainer.

Link copied to clipboard

This methode is uses to get the element by the key.

Link copied to clipboard
open override fun <P : Any, C : Any> getPrimitive(key: String, type: PersistentDataType<P, C>): P?

Gets the primitive value associated with the specified key.

Link copied to clipboard
fun <P : Any, C : Any, T : PersistentDataType<P, C>, DefaultPersistentDataType<C>> PersistentDataContainer.getWithDefault(key: String, type: T, default: C = type.defaultValue): C

This method is used to get the value of the specified key from the PersistentDataContainer.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun isEmpty(): Boolean
Link copied to clipboard
open operator override fun iterator(): Iterator<String>
Link copied to clipboard
open override fun saveTo(output: OutputStream, serializer: SerializerStrategy)

Saves the data in the container to the specified output stream.

Link copied to clipboard
Link copied to clipboard

Converts the current PersistentDataContainer instance to an immutable implementation.

Link copied to clipboard

Converts this container's contents to a Map.

Link copied to clipboard

Attempts to retrieve a value from the persistent data container associated with the specified key and type, returning the result wrapped in a Result type.