Class DataContainerManager

java.lang.Object
me.thehandsomeyoni.persistentdataapi.data.DataContainerManager

public class DataContainerManager extends Object
  • Constructor Details

    • DataContainerManager

      public DataContainerManager(org.bukkit.persistence.PersistentDataContainer container)
      Initializes the DataContainerManager for a given persistent data.
      Parameters:
      container - The persistent data container.
  • Method Details

    • setSerialized

      public void setSerialized(String key, Serializable value)
      Serializes and writes the data in the container.
      Parameters:
      key - The key of the data.
      value - The value of the data.
    • getSerialized

      public byte[] getSerialized(String key)
      Gives the data associated with the given key in bytes.
      Parameters:
      key - The key of the data.
      Returns:
      The data in bytes.
    • getDeserialized

      public Serializable getDeserialized(String key)
      Gives the data associated with the given key in the given type.
      Parameters:
      key - The key of the data.
      Returns:
      The data in the given type.
    • getDeserialized

      public Serializable getDeserialized(org.bukkit.NamespacedKey key)
      Gets the data associated with the given key in the given type.
      Parameters:
      key - The key of the data.
      Returns:
      The data in the given type.
    • getAllKeys

      public Set<String> getAllKeys()
    • getAll

      public HashMap<String,Serializable> getAll()
    • remove

      public void remove(String key)
      Deletes the data associated with the given key.
      Parameters:
      key - The key of the data.
    • getContainer

      public org.bukkit.persistence.PersistentDataContainer getContainer()
      Gives the persistent data container.
      Returns:
      The persistent data container.
    • has

      public boolean has(String key)
      Checks if the data associated with the given key exists.
      Returns:
      True if the data exists, false otherwise.