Class DataContainerManager
java.lang.Object
me.thehandsomeyoni.persistentdataapi.data.DataContainerManager
-
Constructor Summary
ConstructorsConstructorDescriptionDataContainerManager
(org.bukkit.persistence.PersistentDataContainer container) Initializes the DataContainerManager for a given persistent data. -
Method Summary
Modifier and TypeMethodDescriptiongetAll()
org.bukkit.persistence.PersistentDataContainer
Gives the persistent data container.getDeserialized
(String key) Gives the data associated with the given key in the given type.getDeserialized
(org.bukkit.NamespacedKey key) Gets the data associated with the given key in the given type.byte[]
getSerialized
(String key) Gives the data associated with the given key in bytes.boolean
Checks if the data associated with the given key exists.void
Deletes the data associated with the given key.void
setSerialized
(String key, Serializable value) Serializes and writes the data in the container.
-
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
Serializes and writes the data in the container.- Parameters:
key
- The key of the data.value
- The value of the data.
-
getSerialized
Gives the data associated with the given key in bytes.- Parameters:
key
- The key of the data.- Returns:
- The data in bytes.
-
getDeserialized
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
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
-
getAll
-
remove
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
Checks if the data associated with the given key exists.- Returns:
- True if the data exists, false otherwise.
-