Class NBTItem

java.lang.Object
org.bukkit.inventory.ItemStack
net.jeqo.bloons.item.NBTItem
All Implemented Interfaces:
Cloneable, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowItem>, net.kyori.adventure.translation.Translatable, org.bukkit.configuration.serialization.ConfigurationSerializable, org.bukkit.Translatable

public class NBTItem extends org.bukkit.inventory.ItemStack
An extension of an Item with the utilities to manage NBT data easier and more efficiently
  • Constructor Summary

    Constructors
    Constructor
    Description
    NBTItem(org.bukkit.inventory.ItemStack item)
    Creates a new NBTItem with NBT data from an existing ItemStack
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Gets a boolean flag from the NBT data of the item
    double
    Gets a double flag from the NBT data of the item
    int
    Gets an integer flag from the NBT data of the item
    Gets a string flag from the NBT data of the item
    boolean
    Checks if the item has a key in its NBT data
    void
    setBooleanFlag(String key, boolean value)
    Sets a boolean flag in the NBT data of the item
    void
    setDoubleFlag(String key, double value)
    Sets a double flag in the NBT data of the item
    void
    setIntegerFlag(String key, int value)
    Sets an integer flag in the NBT data of the item
    void
    Sets a string flag in the NBT data of the item

    Methods inherited from class org.bukkit.inventory.ItemStack

    add, add, addEnchantment, addEnchantments, addItemFlags, addUnsafeEnchantment, addUnsafeEnchantments, asHoverEvent, asOne, asQuantity, canRepair, clone, computeTooltipLines, containsEnchantment, damage, deserialize, deserializeBytes, displayName, editMeta, editMeta, empty, enchantWithLevels, ensureServerConversions, equals, getAmount, getData, getDurability, getEnchantmentLevel, getEnchantments, getI18NDisplayName, getItemFlags, getItemMeta, getLore, getMaxItemUseDuration, getMaxStackSize, getRarity, getTranslationKey, getType, hashCode, hasItemFlag, hasItemMeta, isEmpty, isRepairableBy, isSimilar, lore, lore, removeEnchantment, removeEnchantments, removeItemFlags, serialize, serializeAsBytes, setAmount, setData, setDurability, setItemMeta, setLore, setType, subtract, subtract, toString, translationKey, withType

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.kyori.adventure.text.event.HoverEventSource

    asHoverEvent
  • Constructor Details

    • NBTItem

      public NBTItem(org.bukkit.inventory.ItemStack item)
      Creates a new NBTItem with NBT data from an existing ItemStack
      Parameters:
      item - The item to derive the NBTItem from, type org.bukkit.inventory.ItemStack
  • Method Details

    • hasKey

      public boolean hasKey(String key)
      Checks if the item has a key in its NBT data
      Parameters:
      key - The key to check for, type java.lang.String
      Returns:
      Whether the key exists in the NBT data, type boolean
    • setStringFlag

      public void setStringFlag(String key, String value)
      Sets a string flag in the NBT data of the item
      Parameters:
      key - The key to set, type java.lang.String
      value - The value to set the key to, type java.lang.String
    • getStringFlag

      public String getStringFlag(String key)
      Gets a string flag from the NBT data of the item
      Parameters:
      key - The key to get, type java.lang.String
      Returns:
      The value of the key, type java.lang.String
    • setIntegerFlag

      public void setIntegerFlag(String key, int value)
      Sets an integer flag in the NBT data of the item
      Parameters:
      key - The key to set, type java.lang.String
      value - The value to set the key to, type int
    • getIntegerFlag

      public int getIntegerFlag(String key)
      Gets an integer flag from the NBT data of the item
      Parameters:
      key - The key to get, type java.lang.String
      Returns:
      The value of the key, type int
    • setDoubleFlag

      public void setDoubleFlag(String key, double value)
      Sets a double flag in the NBT data of the item
      Parameters:
      key - The key to set, type java.lang.String
      value - The value to set the key to, type double
    • getDoubleFlag

      public double getDoubleFlag(String key)
      Gets a double flag from the NBT data of the item
      Parameters:
      key - The key to get, type java.lang.String
      Returns:
      The value of the key, type double
    • setBooleanFlag

      public void setBooleanFlag(String key, boolean value)
      Sets a boolean flag in the NBT data of the item
      Parameters:
      key - The key to set, type java.lang.String
      value - The value to set the key to, type boolean
    • getBooleanFlag

      public boolean getBooleanFlag(String key)
      Gets a boolean flag from the NBT data of the item
      Parameters:
      key - The key to get, type java.lang.String
      Returns:
      The value of the key, type boolean