Interface MetadataStore

All Known Implementing Classes:
SimpleMetadataStore

public interface MetadataStore
Represents a storage system for metadata
  • Method Details

    • clone

      MetadataStore clone()
      Copies the metadata store.
    • get

      default <T> T get(NPC.Metadata key)
      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

      default <T> T get(NPC.Metadata key, T def)
      Fetches metadata from the given key.
      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

      <T> T get(String key)
      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

      <T> T get(String key, T def)
      Fetches metadata from the given key. Sets the default value provided via set(String, Object) if the metadata is not already stored.
      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

      default boolean has(NPC.Metadata key)
      Returns whether the metadata exists.
      Parameters:
      key - The metadata key
      Returns:
      Whether the metadata exists
    • has

      boolean has(String key)
      Returns whether the metadata exists.
      Parameters:
      key - The metadata key
      Returns:
      Whether the metadata exists
    • loadFrom

      void loadFrom(DataKey key)
      Loads persistent metadata from the given DataKey.
      Parameters:
      key - The key to load from
    • remove

      default void remove(NPC.Metadata key)
      Removes any metadata at the given metadata key.
      Parameters:
      key - The metadata key
    • remove

      void remove(String key)
      Removes any metadata at the given metadata key.
      Parameters:
      key - The metadata key
    • saveTo

      void saveTo(DataKey key)
      Saves persistent metadata to the given DataKey.
      Parameters:
      key - The key to save to.
    • set

      default void set(NPC.Metadata key, Object data)
      Stores data at the given key. Data will not persist.
      Parameters:
      key - The metadata key
      data - The data to store
    • set

      void set(String key, Object data)
      Stores data at the given key. Data will not persist.
      Parameters:
      key - The metadata key
      data - The data to store
    • setPersistent

      default void setPersistent(NPC.Metadata key, Object data)
      Stores data at the given key. Data will persist and must be a primitive type or String.
      Parameters:
      key - The metadata key
      data - The data to store
    • setPersistent

      void setPersistent(String key, Object data)
      Stores data at the given key. Data will persist and must be a primitive type or String.
      Parameters:
      key - The metadata key
      data - The data to store
    • size

      int size()
      Returns:
      The number of elements in the store