Interface AdditionsItem
public interface AdditionsItem
Custom AdditionsPlus Item class.
Allows the creation of custom items with left and right click actions and full customization.
-
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.inventory.ItemStack
determineMaterial
(org.bukkit.entity.Player player) Determine the base material of this item based on the player in case of any placeholder usage.Get the non left-right click actions of this item.int
Get the item amount.Get the HEX armor color.long
Get the cooldown in ticks.Get the on-cooldown message of this item.int
Get the custom model data of this item.byte
getData()
Get the data of this item.
This is used in legacy versions of Minecraft to differentiate different versions of an item (such as wool colors), but was later replaced with individual material names.Get the display name of this item.short
Get the durability of this item.Get a list of the enchantments and their strengths.int
Get the cost of this item interaction.List<org.bukkit.inventory.ItemFlag>
Get the item flags of this item.Get aList
ofItemOption
of this item.Get the left click actions of this item.getLore()
Get the lore of this item.Get the material of this item.getName()
Get the identifier of this custom menu.Get the message that is sent to the player when they do not have permission for this item.Get the not enough items message.Get the required Bukkit permission of this item.Get the potion color in HEX.Get the potion type.Get the right click actions of this item.int
getSlot()
Get the inventory slot of this item.org.bukkit.inventory.ItemStack
giveItem
(org.bukkit.entity.Player player, boolean give) Give this custom item to a player.boolean
Get whether this potion is extended.boolean
Get whether this item should be unbreakable.boolean
Get whether this potion is upgraded.void
setActions
(List<String> actions) Set the non left-right click actions of this item.void
setAmount
(int amount) Set the item amount.void
setArmorColor
(String color) Set the armor color of this item.void
setCooldown
(long cooldown) Set the cooldown in ticks.void
setCooldownMessage
(String cooldownMessage) Set the on-cooldown message of this item.void
setCustomModelData
(int customModelData) Set the custom model data of this item.void
setData
(byte data) Set the data of this item.
This is used in legacy versions of Minecraft to differentiate different versions of an item (such as wool colors), but was later replaced with individual material names.void
setDisplayName
(String displayName) Set the display name of this item.void
setDurability
(short durability) Set the durability of this item.void
setEnchantments
(HashMap<org.bukkit.enchantments.Enchantment, Integer> enchantments) Set the enchantments of this item.void
setExtendedPotion
(boolean extendedPotion) Set whether this potion is extended.void
setItemCostOnInteraction
(int amount) Set the cost of this item interaction.void
setItemFlags
(List<org.bukkit.inventory.ItemFlag> flags) Set the item flags of this item.void
setItemOptions
(List<ItemOption> options) Set aList
ofItemOption
.void
setItemStack
(org.bukkit.inventory.ItemStack itemStack) Set the cached item stack.void
setLeftClickActions
(List<String> actions) Set the left click actions of this item.void
Set the lore of this item.void
setMaterial
(String material) Set the material of this item.void
setNoPermissionMessage
(String message) Set the message that is sent to the player when they do not have permission for this item.void
setNotEnoughItemsMessage
(String message) Set the not enough items message.void
setPermission
(String permission) Set the permission of this item.void
setPotionColor
(String color) Set the potion color in HEX.void
setPotionType
(String type) Set the type of potion.void
setRightClickActions
(List<String> actions) Set the right click actions of this item.void
setSlot
(int slot) Set the inventory slot of this item.void
setUnbreakable
(boolean unbreakable) Set whether this item should be unbreakable.void
setUpgradedPotion
(boolean upgradedPotion) Set whether this potion is upgraded.
-
Method Details
-
getName
String getName()Get the identifier of this custom menu.- Returns:
- Identifier of this menu.
-
getItemCostOnInteraction
int getItemCostOnInteraction()Get the cost of this item interaction.- Returns:
- Cost of the interaction.
-
setItemCostOnInteraction
void setItemCostOnInteraction(int amount) Set the cost of this item interaction.- Parameters:
amount
- Cost of the interaction.
-
getNotEnoughItemsMessage
String getNotEnoughItemsMessage()Get the not enough items message.- Returns:
- Not enough items message.
-
setNotEnoughItemsMessage
Set the not enough items message.- Parameters:
message
- Message to send.
-
setItemStack
void setItemStack(org.bukkit.inventory.ItemStack itemStack) Set the cached item stack.- Parameters:
itemStack
-ItemStack
to cache.
-
getSlot
int getSlot()Get the inventory slot of this item.- Returns:
- Inventory slot of this item.
-
setSlot
void setSlot(int slot) Set the inventory slot of this item.- Parameters:
slot
- Slot of this item.
-
getCooldown
long getCooldown()Get the cooldown in ticks.- Returns:
- Cooldown in ticks.
-
setCooldown
void setCooldown(long cooldown) Set the cooldown in ticks.- Parameters:
cooldown
- Cooldown in ticks.
-
getCooldownMessage
String getCooldownMessage()Get the on-cooldown message of this item.- Returns:
- Cooldown message.
-
setCooldownMessage
Set the on-cooldown message of this item.- Parameters:
cooldownMessage
- Message to send.
-
getPermission
String getPermission()Get the required Bukkit permission of this item.- Returns:
- Required Bukkit permission.
-
setPermission
Set the permission of this item.- Parameters:
permission
- Bukkit permission.
-
getNoPermissionMessage
String getNoPermissionMessage()Get the message that is sent to the player when they do not have permission for this item.- Returns:
- No permission message to send.
-
setNoPermissionMessage
Set the message that is sent to the player when they do not have permission for this item.- Parameters:
message
- Message to send.
-
getActions
Get the non left-right click actions of this item.- Returns:
List
of actions.
-
setActions
Set the non left-right click actions of this item.- Parameters:
actions
-List
of actions.
-
getLeftClickActions
Get the left click actions of this item.- Returns:
List
of actions.
-
setLeftClickActions
Set the left click actions of this item.- Parameters:
actions
-List
of actions.
-
getRightClickActions
Get the right click actions of this item.- Returns:
List
of actions.
-
setRightClickActions
Set the right click actions of this item.- Parameters:
actions
-List
of actions.
-
getItemOptions
List<ItemOption> getItemOptions()Get aList
ofItemOption
of this item.- Returns:
List
ofItemOption
.
-
setItemOptions
Set aList
ofItemOption
.- Parameters:
options
-List
ofItemOption
.
-
getDisplayName
String getDisplayName()Get the display name of this item.- Returns:
- Display name of this item.
-
setDisplayName
Set the display name of this item.- Parameters:
displayName
- Display name of this item.
-
getMaterial
String getMaterial()Get the material of this item.- Returns:
- Material of this item.
-
setMaterial
Set the material of this item.- Parameters:
material
- Material of this item.
-
getData
byte getData()Get the data of this item.
This is used in legacy versions of Minecraft to differentiate different versions of an item (such as wool colors), but was later replaced with individual material names.- Returns:
Byte
data.
-
setData
void setData(byte data) Set the data of this item.
This is used in legacy versions of Minecraft to differentiate different versions of an item (such as wool colors), but was later replaced with individual material names.- Parameters:
data
-Byte
data.
-
getAmount
int getAmount()Get the item amount.- Returns:
- Amount of items.
-
setAmount
void setAmount(int amount) Set the item amount.- Parameters:
amount
- Amount of items.
-
getDurability
short getDurability()Get the durability of this item. Durability is the number of useful actions an item can perform which depletes on item use.- Returns:
Short
durability.
-
setDurability
void setDurability(short durability) Set the durability of this item. Durability is the number of useful actions an item can perform which depletes on item use.- Parameters:
durability
-Short
durability.
-
getLore
Get the lore of this item.- Returns:
List
of lore lines.
-
setLore
Set the lore of this item.- Parameters:
lore
-List
of lore lines.
-
getItemFlags
List<org.bukkit.inventory.ItemFlag> getItemFlags()Get the item flags of this item.- Returns:
List
ofItemFlag
.
-
setItemFlags
Set the item flags of this item.- Parameters:
flags
-List
ofItemFlag
.
-
getEnchantments
Get a list of the enchantments and their strengths.- Returns:
HashMap
ofEnchantment
and their strength
-
setEnchantments
Set the enchantments of this item.- Parameters:
enchantments
-HashMap
ofEnchantment
and their strength.
-
isUnbreakable
boolean isUnbreakable()Get whether this item should be unbreakable.- Returns:
- True when enabled, false otherwise.
-
setUnbreakable
void setUnbreakable(boolean unbreakable) Set whether this item should be unbreakable.- Parameters:
unbreakable
- Unbreakable.
-
getCustomModelData
int getCustomModelData()Get the custom model data of this item. This is often used in texture packs.- Returns:
- Custom model data.
-
setCustomModelData
void setCustomModelData(int customModelData) Set the custom model data of this item. This is often used in texture packs.- Parameters:
customModelData
- Custom model data.
-
getArmorColor
String getArmorColor()Get the HEX armor color.- Returns:
- HEX armor color.
-
setArmorColor
Set the armor color of this item.- Parameters:
color
- HEX armor color.
-
determineMaterial
org.bukkit.inventory.ItemStack determineMaterial(org.bukkit.entity.Player player) Determine the base material of this item based on the player in case of any placeholder usage.- Parameters:
player
- Placeholder owner.- Returns:
- Base
ItemStack
.
-
giveItem
org.bukkit.inventory.ItemStack giveItem(org.bukkit.entity.Player player, boolean give) Give this custom item to a player.- Parameters:
player
- Player to apply data to.give
- Whether to add it to their inventory.- Returns:
ItemStack
with the player's data applied to this item.
-
isExtendedPotion
boolean isExtendedPotion()Get whether this potion is extended.- Returns:
- True if enabled, false otherwise.
-
setExtendedPotion
void setExtendedPotion(boolean extendedPotion) Set whether this potion is extended.- Parameters:
extendedPotion
- Extended potion.
-
isUpgradedPotion
boolean isUpgradedPotion()Get whether this potion is upgraded.- Returns:
- True if enabled, false otherwise.
-
setUpgradedPotion
void setUpgradedPotion(boolean upgradedPotion) Set whether this potion is upgraded.- Parameters:
upgradedPotion
- Upgraded potion.
-
getPotionColor
String getPotionColor()Get the potion color in HEX.- Returns:
- HEX potion color when found, null otherwise.
-
setPotionColor
Set the potion color in HEX.- Parameters:
color
- HEX potion color.
-
getPotionType
String getPotionType()Get the potion type.- Returns:
- Type of potion when found, null otherwise.
-
setPotionType
Set the type of potion.- Parameters:
type
- Potion type.
-