Package com.burchard36.api.utils
Class ItemWrapper
java.lang.Object
com.burchard36.api.utils.ItemWrapper
- Direct Known Subclasses:
ClickableItem
A basic class to wrap around
ItemStack-
Constructor Summary
ConstructorsConstructorDescriptionItemWrapper(org.bukkit.inventory.ItemStack stack)Specifies directly whatItemStackyou want to wrap aroundItemWrapper(org.bukkit.Material material)Creates aItemStackwith aIntegerof 1 as the amountItemWrapper(org.bukkit.Material material, int amount) -
Method Summary
Modifier and TypeMethodDescriptionaddDataInteger(String key, int value)addDataString(String key, String value)addEnchantment(org.bukkit.enchantments.Enchantment enchantment, int level)Adds a specificEnchantmentwith a specifiedIntegerleveladdEnchantments(HashMap<org.bukkit.enchantments.Enchantment,Integer> enchantments)addItemLore(String... lore)Adds a Lore line to the linkedItemStackMight be nullgetIntegerDataValue(String key)org.bukkit.inventory.ItemStackReturns the ItemStack from constructorgetLore()Might be nullgetStringDataValue(String key)booleanhasDataInteger(String key)booleanhasDataString(String key)setDisplayName(String displayName)Sets the display name of the wrappedItemStacksetItemLore(List<String> itemLore)Sets the items Lore directlysetModelData(int data)Sets the CustomModelDataIntegerof theItemStacksetSkullTo(UUID playerUuid)If the linkedItemStackis a PLAYER_HEAD, it will set a owning player'sUUID
-
Constructor Details
-
ItemWrapper
public ItemWrapper(org.bukkit.inventory.ItemStack stack)Specifies directly whatItemStackyou want to wrap around- Parameters:
stack- AItemStack
-
ItemWrapper
public ItemWrapper(@Nonnull org.bukkit.Material material)Creates aItemStackwith aIntegerof 1 as the amount- Parameters:
material- AMaterialenum
-
ItemWrapper
public ItemWrapper(@Nonnull org.bukkit.Material material, int amount)- Parameters:
material- AMaterialto useamount- AIntegeramount
-
-
Method Details
-
getDisplayName
Might be null- Returns:
- String of display name, or null
-
getLore
Might be null- Returns:
- List of Strings for the lore, or null
-
setDisplayName
Sets the display name of the wrappedItemStack- Parameters:
displayName- AStringto set theItemStack's name to, color codes automatically handled- Returns:
- Instance of this
ItemWrapper
-
addItemLore
Adds a Lore line to the linkedItemStack- Parameters:
lore- a list ofString's, color codes automatically handled- Returns:
- instance of this
ItemWrapper
-
setItemLore
Sets the items Lore directly- Parameters:
itemLore- AListofString's- Returns:
- instance of this
ItemWrapper
-
setModelData
Sets the CustomModelDataIntegerof theItemStack- Parameters:
data- AIntegerto set- Returns:
- instance of this
ItemWrapper
-
addEnchantment
public final ItemWrapper addEnchantment(org.bukkit.enchantments.Enchantment enchantment, int level)Adds a specificEnchantmentwith a specifiedIntegerlevel- Parameters:
enchantment- AnEnchantmentto applylevel- AIntegerlevel to set- Returns:
- instance of this
ItemWrapper
-
addEnchantments
public final ItemWrapper addEnchantments(HashMap<org.bukkit.enchantments.Enchantment,Integer> enchantments)- Parameters:
enchantments- aMaporEnchantmentenums andIntegeras level-values- Returns:
- instance of this
ItemWrapper
-
setSkullTo
If the linkedItemStackis a PLAYER_HEAD, it will set a owning player'sUUID- Parameters:
playerUuid- The player'sUUID- Returns:
- instance of this
ItemWrapper
-
addDataString
- Parameters:
key- AStringvalue for the key to be set asvalue- AStringvalue for the value to be set as- Returns:
- instance of this
ItemWrapper
-
addDataInteger
- Parameters:
key- AStringvalue for the key to be set asvalue- AIntegervalue for the value to be set as- Returns:
- instance of this
ItemWrapper
-
getStringDataValue
-
getIntegerDataValue
-
hasDataString
-
hasDataInteger
-
getItemStack
public final org.bukkit.inventory.ItemStack getItemStack()Returns the ItemStack from constructor- Returns:
- ItemStack, may be modified!
-