getOrDefault

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

If the key does not exist, it will return default.

Return

The value of the specified key, or default if the key does not exist.

Author

Fantamomo

Since

1.0-SNAPSHOT

Parameters

key

The key to get the value for.

type

The type of the value to get.

default

The default value to return if the key does not exist.


fun <P : Any, C : Any> PersistentDataContainer.getOrDefault(key: String, type: PersistentDataType<P, C>, default: () -> C): C(source)

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

If the key does not exist, it will call the default function to get the default value.

Return

The value of the specified key, or the result of default if the key does not exist.

Author

Fantamomo

Since

1.0-SNAPSHOT

Parameters

key

The key to get the value for.

type

The type of the value to get.

default

The function to call to get the default value if the key does not exist.