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 whatItemStack
you want to wrap aroundItemWrapper(org.bukkit.Material material)
Creates aItemStack
with aInteger
of 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 specificEnchantment
with a specifiedInteger
leveladdEnchantments(HashMap<org.bukkit.enchantments.Enchantment,Integer> enchantments)
addItemLore(String... lore)
Adds a Lore line to the linkedItemStack
Might be nullgetIntegerDataValue(String key)
org.bukkit.inventory.ItemStack
Returns the ItemStack from constructorgetLore()
Might be nullgetStringDataValue(String key)
boolean
hasDataInteger(String key)
boolean
hasDataString(String key)
setDisplayName(String displayName)
Sets the display name of the wrappedItemStack
setItemLore(List<String> itemLore)
Sets the items Lore directlysetModelData(int data)
Sets the CustomModelDataInteger
of theItemStack
setSkullTo(UUID playerUuid)
If the linkedItemStack
is a PLAYER_HEAD, it will set a owning player'sUUID
-
Constructor Details
-
ItemWrapper
public ItemWrapper(org.bukkit.inventory.ItemStack stack)Specifies directly whatItemStack
you want to wrap around- Parameters:
stack
- AItemStack
-
ItemWrapper
public ItemWrapper(@Nonnull org.bukkit.Material material)Creates aItemStack
with aInteger
of 1 as the amount- Parameters:
material
- AMaterial
enum
-
ItemWrapper
public ItemWrapper(@Nonnull org.bukkit.Material material, int amount)- Parameters:
material
- AMaterial
to useamount
- AInteger
amount
-
-
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
- AString
to 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
- AList
ofString
's- Returns:
- instance of this
ItemWrapper
-
setModelData
Sets the CustomModelDataInteger
of theItemStack
- Parameters:
data
- AInteger
to set- Returns:
- instance of this
ItemWrapper
-
addEnchantment
public final ItemWrapper addEnchantment(org.bukkit.enchantments.Enchantment enchantment, int level)Adds a specificEnchantment
with a specifiedInteger
level- Parameters:
enchantment
- AnEnchantment
to applylevel
- AInteger
level to set- Returns:
- instance of this
ItemWrapper
-
addEnchantments
public final ItemWrapper addEnchantments(HashMap<org.bukkit.enchantments.Enchantment,Integer> enchantments)- Parameters:
enchantments
- aMap
orEnchantment
enums andInteger
as level-values- Returns:
- instance of this
ItemWrapper
-
setSkullTo
If the linkedItemStack
is a PLAYER_HEAD, it will set a owning player'sUUID
- Parameters:
playerUuid
- The player'sUUID
- Returns:
- instance of this
ItemWrapper
-
addDataString
- Parameters:
key
- AString
value for the key to be set asvalue
- AString
value for the value to be set as- Returns:
- instance of this
ItemWrapper
-
addDataInteger
- Parameters:
key
- AString
value for the key to be set asvalue
- AInteger
value 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!
-