Class NBT

java.lang.Object
valorless.valorlessutils.nbt.NBT

public class NBT extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    NBT()
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    GetBool(org.bukkit.inventory.ItemStack item, String key)
    Retrieves a boolean value from the NBT data of an ItemStack.
    static Double
    GetDouble(org.bukkit.inventory.ItemStack item, String key)
    Retrieves a double value from the NBT data of an ItemStack.
    static Float
    GetFloat(org.bukkit.inventory.ItemStack item, String key)
    Retrieves a float value from the NBT data of an ItemStack.
    static Integer
    GetInt(org.bukkit.inventory.ItemStack item, String key)
    Retrieves an integer value from the NBT data of an ItemStack.
    static List<Integer>
    GetIntArray(org.bukkit.inventory.ItemStack item, String key)
    Retrieves an integer array from the NBT data of an ItemStack.
    static String
    GetString(org.bukkit.inventory.ItemStack item, String key)
    Retrieves a string value from the NBT data of an ItemStack.
    static List<String>
    GetStringList(org.bukkit.inventory.ItemStack item, String key)
    Retrieves a List value from the NBT data of an ItemStack.
    static UUID
    GetUUID(org.bukkit.inventory.ItemStack item, String key)
    Retrieves a UUID value from the NBT data of an ItemStack.
    static boolean
    Has(org.bukkit.inventory.ItemStack item, String key)
    Checks if the NBT data of an ItemStack contains a given key.
    static boolean
    Remove(org.bukkit.inventory.ItemStack item, String key)
    Removes a key from the NBT data of an ItemStack.
    static void
    SetBool(org.bukkit.inventory.ItemStack item, String key, boolean value)
    Sets a boolean value in the NBT data of an ItemStack.
    static void
    SetDouble(org.bukkit.inventory.ItemStack item, String key, Double value)
    Sets a double value in the NBT data of an ItemStack.
    static void
    SetFloat(org.bukkit.inventory.ItemStack item, String key, Float value)
    Sets a float value in the NBT data of an ItemStack.
    static void
    SetInt(org.bukkit.inventory.ItemStack item, String key, Integer value)
    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
    SetString(org.bukkit.inventory.ItemStack item, String key, String value)
    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
    SetUUID(org.bukkit.inventory.ItemStack item, String key, UUID value)
    Sets a UUID value in the NBT data of an ItemStack.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NBT

      public NBT()
  • Method Details

    • SetString

      public static void SetString(org.bukkit.inventory.ItemStack item, String key, String value)
      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 List value to set.
    • SetInt

      public static void SetInt(org.bukkit.inventory.ItemStack item, String key, Integer value)
      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

      public static void SetIntArray(org.bukkit.inventory.ItemStack item, String key, int[] value)
      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

      public static void SetFloat(org.bukkit.inventory.ItemStack item, String key, Float value)
      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

      public static void SetDouble(org.bukkit.inventory.ItemStack item, String key, Double value)
      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

      public static void SetBool(org.bukkit.inventory.ItemStack item, String key, boolean value)
      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

      public static void SetUUID(org.bukkit.inventory.ItemStack item, String key, UUID value)
      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

      public static String GetString(org.bukkit.inventory.ItemStack item, String key)
      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

      public static List<String> GetStringList(org.bukkit.inventory.ItemStack item, String key)
      Retrieves a List value 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

      public static Integer GetInt(org.bukkit.inventory.ItemStack item, String key)
      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

      public static List<Integer> GetIntArray(org.bukkit.inventory.ItemStack item, String key)
      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

      public static Float GetFloat(org.bukkit.inventory.ItemStack item, String key)
      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

      public static Double GetDouble(org.bukkit.inventory.ItemStack item, String key)
      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

      public static boolean GetBool(org.bukkit.inventory.ItemStack item, String key)
      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

      public static UUID GetUUID(org.bukkit.inventory.ItemStack item, String key)
      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

      public static boolean Has(org.bukkit.inventory.ItemStack item, String key)
      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

      public static boolean Remove(org.bukkit.inventory.ItemStack item, String key)
      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).