Package net.jeqo.bloons.item
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
ConstructorsConstructorDescriptionNBTItem
(org.bukkit.inventory.ItemStack item) Creates a new NBTItem with NBT data from an existing ItemStack -
Method Summary
Modifier and TypeMethodDescriptionboolean
getBooleanFlag
(String key) Gets a boolean flag from the NBT data of the itemdouble
getDoubleFlag
(String key) Gets a double flag from the NBT data of the itemint
getIntegerFlag
(String key) Gets an integer flag from the NBT data of the itemgetStringFlag
(String key) Gets a string flag from the NBT data of the itemboolean
Checks if the item has a key in its NBT datavoid
setBooleanFlag
(String key, boolean value) Sets a boolean flag in the NBT data of the itemvoid
setDoubleFlag
(String key, double value) Sets a double flag in the NBT data of the itemvoid
setIntegerFlag
(String key, int value) Sets an integer flag in the NBT data of the itemvoid
setStringFlag
(String key, String value) Sets a string flag in the NBT data of the itemMethods 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
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
Sets a string flag in the NBT data of the item- Parameters:
key
- The key to set, type java.lang.Stringvalue
- The value to set the key to, type java.lang.String
-
getStringFlag
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
Sets an integer flag in the NBT data of the item- Parameters:
key
- The key to set, type java.lang.Stringvalue
- The value to set the key to, type int
-
getIntegerFlag
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
Sets a double flag in the NBT data of the item- Parameters:
key
- The key to set, type java.lang.Stringvalue
- The value to set the key to, type double
-
getDoubleFlag
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
Sets a boolean flag in the NBT data of the item- Parameters:
key
- The key to set, type java.lang.Stringvalue
- The value to set the key to, type boolean
-
getBooleanFlag
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
-