Class PDCTag
java.lang.Object
com.github.darksoulq.abyssallib.world.util.PDCTag
A wrapper for Bukkit's
PersistentDataContainer (PDC) API.
This class simplifies data persistence on Bukkit objects (like ItemMeta, Entities, and TileEntities)
by abstracting PersistentDataType handling and utilizing NamespacedKey
for key management.
-
Constructor Summary
ConstructorsConstructorDescriptionPDCTag(org.bukkit.persistence.PersistentDataContainer container) Constructs a new PDCTag wrapper for a specific container. -
Method Summary
Modifier and TypeMethodDescriptiongetBoolean(org.bukkit.NamespacedKey key) Retrieves a Boolean value from the container.getByte(org.bukkit.NamespacedKey key) Retrieves a Byte value from the container.Optional<byte[]> getByteArray(org.bukkit.NamespacedKey key) Retrieves a Byte array from the container.getFloat(org.bukkit.NamespacedKey key) Retrieves a Float value from the container.getInt(org.bukkit.NamespacedKey key) Retrieves an Integer value from the container.Optional<int[]> getIntArray(org.bukkit.NamespacedKey key) Retrieves an Integer array from the container.getString(org.bukkit.NamespacedKey key) Retrieves a String value from the container.voidset(org.bukkit.NamespacedKey key, boolean value) Stores a boolean value in the container.voidset(org.bukkit.NamespacedKey key, byte value) Stores a byte value in the container.voidset(org.bukkit.NamespacedKey key, byte[] value) Stores a byte array in the container.voidset(org.bukkit.NamespacedKey key, float value) Stores a float value in the container.voidset(org.bukkit.NamespacedKey key, int value) Stores an integer value in the container.voidset(org.bukkit.NamespacedKey key, int[] value) Stores an integer array in the container.voidStores a String value in the container.org.bukkit.persistence.PersistentDataContainerReturns the raw Bukkit container.
-
Constructor Details
-
PDCTag
public PDCTag(org.bukkit.persistence.PersistentDataContainer container) Constructs a new PDCTag wrapper for a specific container.- Parameters:
container- ThePersistentDataContainerto wrap.
-
-
Method Details
-
set
Stores a String value in the container.- Parameters:
key- The uniqueNamespacedKeykey.value- The string value to store.
-
set
public void set(org.bukkit.NamespacedKey key, int value) Stores an integer value in the container.- Parameters:
key- The uniqueNamespacedKeykey.value- The integer value to store.
-
set
public void set(org.bukkit.NamespacedKey key, int[] value) Stores an integer array in the container.- Parameters:
key- The uniqueNamespacedKeykey.value- The integer array to store.
-
set
public void set(org.bukkit.NamespacedKey key, boolean value) Stores a boolean value in the container.- Parameters:
key- The uniqueNamespacedKeykey.value- The boolean value to store.
-
set
public void set(org.bukkit.NamespacedKey key, float value) Stores a float value in the container.- Parameters:
key- The uniqueNamespacedKeykey.value- The float value to store.
-
set
public void set(org.bukkit.NamespacedKey key, byte value) Stores a byte value in the container.- Parameters:
key- The uniqueNamespacedKeykey.value- The byte value to store.
-
set
public void set(org.bukkit.NamespacedKey key, byte[] value) Stores a byte array in the container.- Parameters:
key- The uniqueNamespacedKeykey.value- The byte array to store.
-
getString
-
getInt
-
getIntArray
-
getBoolean
-
getFloat
-
getByte
-
getByteArray
-
toVanilla
public org.bukkit.persistence.PersistentDataContainer toVanilla()Returns the raw Bukkit container.- Returns:
- The underlying
PersistentDataContainer.
-