Package net.citizensnpcs.api.npc
Interface MetadataStore
- All Known Implementing Classes:
SimpleMetadataStore
public interface MetadataStore
Represents a storage system for metadata
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Copies the metadata store.<T> T
Fetches metadata from the given key.<T> T
Fetches metadata from the given key.default <T> T
get
(NPC.Metadata key) Fetches metadata from the given key.default <T> T
get
(NPC.Metadata key, T def) Fetches metadata from the given key.boolean
Returns whether the metadata exists.default boolean
has
(NPC.Metadata key) Returns whether the metadata exists.void
Loads persistent metadata from the givenDataKey
.void
Removes any metadata at the given metadata key.default void
remove
(NPC.Metadata key) Removes any metadata at the given metadata key.void
Saves persistent metadata to the givenDataKey
.void
Stores data at the given key.default void
set
(NPC.Metadata key, Object data) Stores data at the given key.void
setPersistent
(String key, Object data) Stores data at the given key.default void
setPersistent
(NPC.Metadata key, Object data) Stores data at the given key.int
size()
-
Method Details
-
clone
MetadataStore clone()Copies the metadata store. -
get
Fetches metadata from the given key.- Parameters:
key
- The key to get metadata from- Returns:
- The metadata at the given key, or null if not found
-
get
Fetches metadata from the given key.- Parameters:
key
- The key to get metadata fromdef
- The default value to return- Returns:
- The metadata at the given key, or def if not found
-
get
Fetches metadata from the given key.- Parameters:
key
- The key to get metadata from- Returns:
- The metadata at the given key, or null if not found
-
get
Fetches metadata from the given key. Sets the default value provided viaset(String, Object)
if the metadata is not already stored.- Parameters:
key
- The key to get metadata fromdef
- The default value to return- Returns:
- The metadata at the given key, or def if not found
-
has
Returns whether the metadata exists.- Parameters:
key
- The metadata key- Returns:
- Whether the metadata exists
-
has
Returns whether the metadata exists.- Parameters:
key
- The metadata key- Returns:
- Whether the metadata exists
-
loadFrom
Loads persistent metadata from the givenDataKey
.- Parameters:
key
- The key to load from
-
remove
Removes any metadata at the given metadata key.- Parameters:
key
- The metadata key
-
remove
Removes any metadata at the given metadata key.- Parameters:
key
- The metadata key
-
saveTo
Saves persistent metadata to the givenDataKey
.- Parameters:
key
- The key to save to.
-
set
Stores data at the given key. Data will not persist.- Parameters:
key
- The metadata keydata
- The data to store
-
set
Stores data at the given key. Data will not persist.- Parameters:
key
- The metadata keydata
- The data to store
-
setPersistent
Stores data at the given key. Data will persist and must be a primitive type orString
.- Parameters:
key
- The metadata keydata
- The data to store
-
setPersistent
Stores data at the given key. Data will persist and must be a primitive type orString
.- Parameters:
key
- The metadata keydata
- The data to store
-
size
int size()- Returns:
- The number of elements in the store
-