Package de.maxbossing.maxapi.Builders
Class ItemStackBuilder.Unsafe.ReflectionUtils
java.lang.Object
de.maxbossing.maxapi.Builders.ItemStackBuilder.Unsafe.ReflectionUtils
- Enclosing class:
ItemStackBuilder.Unsafe
This Class contains highly sensitive NMS Code that should not be touched unless you want to break the ItemBuilder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetBoolean(org.bukkit.inventory.ItemStack item, String key) Gets a boolean at given key of nbt data of given item.Class<?>get Craft Item Stack ClassdoubleReturns a Double saved in the nbt data of item at given nbt key Returns NaN if key does not existintReturns an int saved in the nbt data of the item at the given key If the key does not exist, it will return -1org.bukkit.inventory.ItemStackgetItemAsBukkitStack(Object nmsStack) get nmsStack object as Bukkit StackgetItemAsNMSStack(org.bukkit.inventory.ItemStack item) get ItemStack as nmsStack objectgetNBTTagCompound(Object nmsStack) get NBT Tag Compoundget New NBT Tag CompoundReturns a String saved in the nbt data of the item at the given key If the key does not exist, it will return nullbooleanchecks if items nbt data contains a keyorg.bukkit.inventory.ItemStacksetBoolean(org.bukkit.inventory.ItemStack item, String key, boolean value) sets a boolean at nbt key of nbt data of itemorg.bukkit.inventory.ItemStacksets a double at the nbt key of the nbt data of the itemorg.bukkit.inventory.ItemStackSets an int at the nbt key of the nbt data of the ItemStackset NBT Tag of Itemorg.bukkit.inventory.ItemStackSets a String at the nbt key of the nbt data of item
-
Constructor Details
-
ReflectionUtils
public ReflectionUtils()
-
-
Method Details
-
getString
Returns a String saved in the nbt data of the item at the given key If the key does not exist, it will return null- Parameters:
item- itemkey- key- Returns:
- the String if successfull, null if not
-
setString
public org.bukkit.inventory.ItemStack setString(org.bukkit.inventory.ItemStack item, String key, String value) Sets a String at the nbt key of the nbt data of item- Parameters:
item- itemkey- keyvalue- value- Returns:
- the ItemStack
-
getInt
Returns an int saved in the nbt data of the item at the given key If the key does not exist, it will return -1- Parameters:
item- itemkey- key- Returns:
- int if success, -1 if key does not exist
-
setInt
public org.bukkit.inventory.ItemStack setInt(org.bukkit.inventory.ItemStack item, String key, int value) Sets an int at the nbt key of the nbt data of the ItemStack- Parameters:
item- itemkey- keyvalue- value- Returns:
- the ItemStack
-
getDouble
Returns a Double saved in the nbt data of item at given nbt key Returns NaN if key does not exist- Parameters:
item- itemkey- key- Returns:
- Double at Success, NaN if key does not exist
-
setDouble
public org.bukkit.inventory.ItemStack setDouble(org.bukkit.inventory.ItemStack item, String key, double value) sets a double at the nbt key of the nbt data of the item- Parameters:
item- itemkey- keyvalue- value- Returns:
- the ItemStack
-
getBoolean
Gets a boolean at given key of nbt data of given item. returns false if key is not existing- Parameters:
item- itemkey- key- Returns:
- boolean at success, false if key does not exist
-
setBoolean
public org.bukkit.inventory.ItemStack setBoolean(org.bukkit.inventory.ItemStack item, String key, boolean value) sets a boolean at nbt key of nbt data of item- Parameters:
item- itemkey- keyvalue- value- Returns:
- the ItemStack
-
hasKey
checks if items nbt data contains a key- Parameters:
item- itemkey- key- Returns:
- true if key does exist, false if not
-
getNewNBTTagCompound
get New NBT Tag Compound- Returns:
- Object
-
setNBTTag
set NBT Tag of Item- Parameters:
tag- tagitem- item- Returns:
- item at success, null if not
-
getNBTTagCompound
get NBT Tag Compound- Parameters:
nmsStack- nmsStack- Returns:
- Object
-
getItemAsNMSStack
get ItemStack as nmsStack object- Parameters:
item- item- Returns:
- object
-
getItemAsBukkitStack
get nmsStack object as Bukkit Stack- Parameters:
nmsStack- nmsStack- Returns:
- ItemStack
-
getCraftItemStackClass
get Craft Item Stack Class- Returns:
- Class
-