Class SimpleMetadataStore

java.lang.Object
net.citizensnpcs.api.npc.SimpleMetadataStore
All Implemented Interfaces:
MetadataStore

public class SimpleMetadataStore extends Object implements MetadataStore
  • Constructor Details

    • SimpleMetadataStore

      public SimpleMetadataStore()
  • Method Details

    • clone

      public MetadataStore clone()
      Description copied from interface: MetadataStore
      Copies the metadata store.
      Specified by:
      clone in interface MetadataStore
      Overrides:
      clone in class Object
    • get

      public <T> T get(NPC.Metadata key)
      Description copied from interface: MetadataStore
      Fetches metadata from the given key.
      Specified by:
      get in interface MetadataStore
      Parameters:
      key - The key to get metadata from
      Returns:
      The metadata at the given key, or null if not found
    • get

      public <T> T get(NPC.Metadata key, T def)
      Description copied from interface: MetadataStore
      Fetches metadata from the given key. Sets the default value provided via MetadataStore.set(String, Object) if the metadata is not already stored.
      Specified by:
      get in interface MetadataStore
      Parameters:
      key - The key to get metadata from
      def - The default value to return
      Returns:
      The metadata at the given key, or def if not found
    • get

      public <T> T get(String key)
      Description copied from interface: MetadataStore
      Fetches metadata from the given key.
      Specified by:
      get in interface MetadataStore
      Parameters:
      key - The key to get metadata from
      Returns:
      The metadata at the given key, or null if not found
    • get

      public <T> T get(String key, T def)
      Description copied from interface: MetadataStore
      Fetches metadata from the given key. Sets the default value provided via MetadataStore.set(String, Object) if the metadata is not already stored.
      Specified by:
      get in interface MetadataStore
      Parameters:
      key - The key to get metadata from
      def - The default value to return
      Returns:
      The metadata at the given key, or def if not found
    • has

      public boolean has(NPC.Metadata key)
      Description copied from interface: MetadataStore
      Returns whether the metadata exists.
      Specified by:
      has in interface MetadataStore
      Parameters:
      key - The metadata key
      Returns:
      Whether the metadata exists
    • has

      public boolean has(String key)
      Description copied from interface: MetadataStore
      Returns whether the metadata exists.
      Specified by:
      has in interface MetadataStore
      Parameters:
      key - The metadata key
      Returns:
      Whether the metadata exists
    • loadFrom

      public void loadFrom(DataKey key)
      Description copied from interface: MetadataStore
      Loads persistent metadata from the given DataKey.
      Specified by:
      loadFrom in interface MetadataStore
      Parameters:
      key - The key to load from
    • remove

      public void remove(String key)
      Description copied from interface: MetadataStore
      Removes any metadata at the given metadata key.
      Specified by:
      remove in interface MetadataStore
      Parameters:
      key - The metadata key
    • saveTo

      public void saveTo(DataKey key)
      Description copied from interface: MetadataStore
      Saves persistent metadata to the given DataKey.
      Specified by:
      saveTo in interface MetadataStore
      Parameters:
      key - The key to save to.
    • set

      public void set(NPC.Metadata key, Object data)
      Description copied from interface: MetadataStore
      Stores data at the given key. Data will not persist.
      Specified by:
      set in interface MetadataStore
      Parameters:
      key - The metadata key
      data - The data to store
    • set

      public void set(String key, Object data)
      Description copied from interface: MetadataStore
      Stores data at the given key. Data will not persist.
      Specified by:
      set in interface MetadataStore
      Parameters:
      key - The metadata key
      data - The data to store
    • setPersistent

      public void setPersistent(NPC.Metadata key, Object data)
      Description copied from interface: MetadataStore
      Stores data at the given key. Data will persist and must be a primitive type or String.
      Specified by:
      setPersistent in interface MetadataStore
      Parameters:
      key - The metadata key
      data - The data to store
    • setPersistent

      public void setPersistent(String key, Object data)
      Description copied from interface: MetadataStore
      Stores data at the given key. Data will persist and must be a primitive type or String.
      Specified by:
      setPersistent in interface MetadataStore
      Parameters:
      key - The metadata key
      data - The data to store
    • size

      public int size()
      Specified by:
      size in interface MetadataStore
      Returns:
      The number of elements in the store