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> TFetches metadata from the given key.<T> TFetches metadata from the given key.default <T> Tget(NPC.Metadata key) Fetches metadata from the given key.default <T> Tget(NPC.Metadata key, T def) Fetches metadata from the given key.booleanReturns whether the metadata exists.default booleanhas(NPC.Metadata key) Returns whether the metadata exists.voidLoads persistent metadata from the givenDataKey.voidRemoves any metadata at the given metadata key.default voidremove(NPC.Metadata key) Removes any metadata at the given metadata key.voidSaves persistent metadata to the givenDataKey.voidStores data at the given key.default voidset(NPC.Metadata key, Object data) Stores data at the given key.voidsetPersistent(String key, Object data) Stores data at the given key.default voidsetPersistent(NPC.Metadata key, Object data) Stores data at the given key.intsize()
-
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
-