Package net.citizensnpcs.api.npc
Class SimpleMetadataStore
java.lang.Object
net.citizensnpcs.api.npc.SimpleMetadataStore
- All Implemented Interfaces:
MetadataStore
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Copies the metadata store.<T> TFetches metadata from the given key.<T> TFetches metadata from the given key.<T> Tget(NPC.Metadata key) Fetches metadata from the given key.<T> Tget(NPC.Metadata key, T def) Fetches metadata from the given key.booleanReturns whether the metadata exists.booleanhas(NPC.Metadata key) Returns whether the metadata exists.voidLoads persistent metadata from the givenDataKey.voidRemoves any metadata at the given metadata key.voidremove(NPC.Metadata key) Removes any metadata at the given metadata key.voidSaves persistent metadata to the givenDataKey.voidStores data at the given key.voidset(NPC.Metadata key, Object data) Stores data at the given key.voidsetPersistent(String key, Object data) Stores data at the given key.voidsetPersistent(NPC.Metadata key, Object data) Stores data at the given key.intsize()
-
Constructor Details
-
SimpleMetadataStore
public SimpleMetadataStore()
-
-
Method Details
-
clone
Description copied from interface:MetadataStoreCopies the metadata store.- Specified by:
clonein interfaceMetadataStore- Overrides:
clonein classObject
-
get
Description copied from interface:MetadataStoreFetches metadata from the given key.- Specified by:
getin interfaceMetadataStore- Parameters:
key- The key to get metadata from- Returns:
- The metadata at the given key, or null if not found
-
get
Description copied from interface:MetadataStoreFetches metadata from the given key.- Specified by:
getin interfaceMetadataStore- 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
Description copied from interface:MetadataStoreFetches metadata from the given key.- Specified by:
getin interfaceMetadataStore- Parameters:
key- The key to get metadata from- Returns:
- The metadata at the given key, or null if not found
-
get
Description copied from interface:MetadataStoreFetches metadata from the given key. Sets the default value provided viaMetadataStore.set(String, Object)if the metadata is not already stored.- Specified by:
getin interfaceMetadataStore- 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
Description copied from interface:MetadataStoreReturns whether the metadata exists.- Specified by:
hasin interfaceMetadataStore- Parameters:
key- The metadata key- Returns:
- Whether the metadata exists
-
has
Description copied from interface:MetadataStoreReturns whether the metadata exists.- Specified by:
hasin interfaceMetadataStore- Parameters:
key- The metadata key- Returns:
- Whether the metadata exists
-
loadFrom
Description copied from interface:MetadataStoreLoads persistent metadata from the givenDataKey.- Specified by:
loadFromin interfaceMetadataStore- Parameters:
key- The key to load from
-
remove
Description copied from interface:MetadataStoreRemoves any metadata at the given metadata key.- Specified by:
removein interfaceMetadataStore- Parameters:
key- The metadata key
-
remove
Description copied from interface:MetadataStoreRemoves any metadata at the given metadata key.- Specified by:
removein interfaceMetadataStore- Parameters:
key- The metadata key
-
saveTo
Description copied from interface:MetadataStoreSaves persistent metadata to the givenDataKey.- Specified by:
saveToin interfaceMetadataStore- Parameters:
key- The key to save to.
-
set
Description copied from interface:MetadataStoreStores data at the given key. Data will not persist.- Specified by:
setin interfaceMetadataStore- Parameters:
key- The metadata keydata- The data to store
-
set
Description copied from interface:MetadataStoreStores data at the given key. Data will not persist.- Specified by:
setin interfaceMetadataStore- Parameters:
key- The metadata keydata- The data to store
-
setPersistent
Description copied from interface:MetadataStoreStores data at the given key. Data will persist and must be a primitive type orString.- Specified by:
setPersistentin interfaceMetadataStore- Parameters:
key- The metadata keydata- The data to store
-
setPersistent
Description copied from interface:MetadataStoreStores data at the given key. Data will persist and must be a primitive type orString.- Specified by:
setPersistentin interfaceMetadataStore- Parameters:
key- The metadata keydata- The data to store
-
size
public int size()- Specified by:
sizein interfaceMetadataStore- Returns:
- The number of elements in the store
-