Package valorless.valorlessutils.nbt
Class NBT
java.lang.Object
valorless.valorlessutils.nbt.NBT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Retrieves a boolean value from the NBT data of an ItemStack.static Double
Retrieves a double value from the NBT data of an ItemStack.static Float
Retrieves a float value from the NBT data of an ItemStack.static Integer
Retrieves an integer value from the NBT data of an ItemStack.GetIntArray
(org.bukkit.inventory.ItemStack item, String key) Retrieves an integer array from the NBT data of an ItemStack.static String
Retrieves a string value from the NBT data of an ItemStack.GetStringList
(org.bukkit.inventory.ItemStack item, String key) Retrieves a Listvalue from the NBT data of an ItemStack. static UUID
Retrieves a UUID value from the NBT data of an ItemStack.static boolean
Checks if the NBT data of an ItemStack contains a given key.static boolean
Removes a key from the NBT data of an ItemStack.static void
Sets a boolean value in the NBT data of an ItemStack.static void
Sets a double value in the NBT data of an ItemStack.static void
Sets a float value in the NBT data of an ItemStack.static void
Sets an integer value in the NBT data of an ItemStack.static void
SetIntArray
(org.bukkit.inventory.ItemStack item, String key, int[] value) Sets an integer array in the NBT data of an ItemStack.static void
Sets a string value in the NBT data of an ItemStack.static void
SetStringList
(org.bukkit.inventory.ItemStack item, String key, List<String> value) Sets a List of strings in the NBT data of an ItemStack.static void
Sets a UUID value in the NBT data of an ItemStack.
-
Constructor Details
-
NBT
public NBT()
-
-
Method Details
-
SetString
Sets a string value in the NBT data of an ItemStack.- Parameters:
item
- The ItemStack to modify.key
- The key to set.value
- The string value to set.
-
SetStringList
public static void SetStringList(org.bukkit.inventory.ItemStack item, String key, List<String> value) Sets a List of strings in the NBT data of an ItemStack. The list is stored as a single string joined by "◊".- Parameters:
item
- The ItemStack to modify.key
- The key to set.value
- The Listvalue to set.
-
SetInt
Sets an integer value in the NBT data of an ItemStack.- Parameters:
item
- The ItemStack to modify.key
- The key to set.value
- The integer value to set.
-
SetIntArray
Sets an integer array in the NBT data of an ItemStack.- Parameters:
item
- The ItemStack to modify.key
- The key to set.value
- The integer array to set.
-
SetFloat
Sets a float value in the NBT data of an ItemStack.- Parameters:
item
- The ItemStack to modify.key
- The key to set.value
- The float value to set.
-
SetDouble
Sets a double value in the NBT data of an ItemStack.- Parameters:
item
- The ItemStack to modify.key
- The key to set.value
- The double value to set.
-
SetBool
Sets a boolean value in the NBT data of an ItemStack.- Parameters:
item
- The ItemStack to modify.key
- The key to set.value
- The boolean value to set.
-
SetUUID
Sets a UUID value in the NBT data of an ItemStack.- Parameters:
item
- The ItemStack to modify.key
- The key to set.value
- The UUID value to set.
-
GetString
Retrieves a string value from the NBT data of an ItemStack.- Parameters:
item
- The ItemStack to retrieve from.key
- The key to retrieve.- Returns:
- The string value or null if not present.
-
GetStringList
Retrieves a Listvalue from the NBT data of an ItemStack. Splits the stored string by "◊". - Parameters:
item
- The ItemStack to retrieve from.key
- The key to retrieve.- Returns:
- The List
value.
-
GetInt
Retrieves an integer value from the NBT data of an ItemStack.- Parameters:
item
- The ItemStack to retrieve from.key
- The key to retrieve.- Returns:
- The integer value.
-
GetIntArray
Retrieves an integer array from the NBT data of an ItemStack.- Parameters:
item
- The ItemStack to retrieve from.key
- The key to retrieve.- Returns:
- The list of integers.
-
GetFloat
Retrieves a float value from the NBT data of an ItemStack.- Parameters:
item
- The ItemStack to retrieve from.key
- The key to retrieve.- Returns:
- The float value.
-
GetDouble
Retrieves a double value from the NBT data of an ItemStack.- Parameters:
item
- The ItemStack to retrieve from.key
- The key to retrieve.- Returns:
- The double value.
-
GetBool
Retrieves a boolean value from the NBT data of an ItemStack.- Parameters:
item
- The ItemStack to retrieve from.key
- The key to retrieve.- Returns:
- The boolean value.
-
GetUUID
Retrieves a UUID value from the NBT data of an ItemStack.- Parameters:
item
- The ItemStack to retrieve from.key
- The key to retrieve.- Returns:
- The UUID value.
-
Has
Checks if the NBT data of an ItemStack contains a given key.- Parameters:
item
- The ItemStack to check.key
- The key to check.- Returns:
- True if the key exists, false otherwise.
-
Remove
Removes a key from the NBT data of an ItemStack.- Parameters:
item
- The ItemStack to modify.key
- The key to remove.- Returns:
- False (always returns false currently; actual removal happens inside the modify call).
-