Class CustomItem
java.lang.Object
com.github.imdabigboss.easydatapack.api.items.CustomItem
- Direct Known Subclasses:
CustomHatItem,CustomToolItem
This class represents a custom item.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis class represents the information about an attribute modifier.static classstatic classThis class represents the information about an enchantment. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCustomItem(int customModelData, @NonNull String namespaceKey, @NonNull String name, @NonNull org.bukkit.Material baseMaterial, boolean unbreakable, boolean hideFlags, boolean newItem, @Nullable Class<? extends org.bukkit.event.Listener> eventListener, @Nullable Consumer<org.bukkit.event.player.PlayerInteractEvent> itemUseEvent, boolean spacingBeforeLore, @Nullable String[] lore, @NonNull Map<org.bukkit.attribute.Attribute,List<org.bukkit.attribute.AttributeModifier>> attributeModifiers, @NonNull Map<org.bukkit.enchantments.Enchantment,Integer> enchantments, @NonNull List<org.bukkit.enchantments.Enchantment> allowedEnchantments, @NonNull List<org.bukkit.enchantments.Enchantment> forbiddenEnchantments) -
Method Summary
Modifier and TypeMethodDescription@NonNull net.kyori.adventure.util.TriStatecanEnchant(@NonNull org.bukkit.enchantments.Enchantment enchantment)@Nullable org.bukkit.enchantments.Enchantment[]Gets a list of enchantments that can be applied to the item, this can be used if the base material doesn't allow the enchantment by default.@NonNull CustomItem.AttributeInformation[]Gets the item's attribute modifiers.@NonNull org.bukkit.MaterialGets the base material of the item.intGets the custom model data of the item.@NonNull CustomItem.EnchantmentInformation[]Gets the item's enchantments.@Nullable Class<? extends org.bukkit.event.Listener>Gets the event listener of the item.@Nullable org.bukkit.enchantments.Enchantment[]Gets a list of enchantments that can't be applied to the item, this can be used if the base material allows the enchantment by default.@NonNull org.bukkit.inventory.ItemStackGets the item stack of the item.@Nullable Consumer<org.bukkit.event.player.PlayerInteractEvent>Gets the event that is fired when the item is used.@Nullable String[]getLore()Gets the item's lore.@NonNull StringgetName()Gets the name of the item.@NonNull org.bukkit.NamespacedKeyGets the namespaced key of the item.@NonNull StringGets the namespace key of the item.booleanGets if the item hides flags.booleanGets if the item is a new item or if it is an extension of an existing item.booleanGets if the item is unbreakable.
-
Field Details
-
itemStack
protected org.bukkit.inventory.ItemStack itemStack
-
-
Constructor Details
-
CustomItem
protected CustomItem(int customModelData, @NonNull String namespaceKey, @NonNull String name, @NonNull org.bukkit.Material baseMaterial, boolean unbreakable, boolean hideFlags, boolean newItem, @Nullable @Nullable Class<? extends org.bukkit.event.Listener> eventListener, @Nullable @Nullable Consumer<org.bukkit.event.player.PlayerInteractEvent> itemUseEvent, boolean spacingBeforeLore, @Nullable @Nullable String[] lore, @NonNull Map<org.bukkit.attribute.Attribute,List<org.bukkit.attribute.AttributeModifier>> attributeModifiers, @NonNull Map<org.bukkit.enchantments.Enchantment,Integer> enchantments, @NonNull List<org.bukkit.enchantments.Enchantment> allowedEnchantments, @NonNull List<org.bukkit.enchantments.Enchantment> forbiddenEnchantments)
-
-
Method Details
-
getCustomModelData
public int getCustomModelData()Gets the custom model data of the item.- Returns:
- the custom model data of the item
-
getNamespaceKey
Gets the namespace key of the item.- Returns:
- the namespace key of the item
-
getNamespacedKey
public @NonNull org.bukkit.NamespacedKey getNamespacedKey()Gets the namespaced key of the item.- Returns:
- the namespaced key of the item
-
getName
Gets the name of the item.- Returns:
- the name of the item
-
getBaseMaterial
public @NonNull org.bukkit.Material getBaseMaterial()Gets the base material of the item.- Returns:
- the base material of the item
-
isUnbreakable
public boolean isUnbreakable()Gets if the item is unbreakable.- Returns:
- if the item is unbreakable
-
isHideFlags
public boolean isHideFlags()Gets if the item hides flags.- Returns:
- if the item hides flags
-
isNewItem
public boolean isNewItem()Gets if the item is a new item or if it is an extension of an existing item.- Returns:
- if the item is a new item
-
getEventListener
Gets the event listener of the item.- Returns:
- the event listener of the item
-
getItemUseEvent
Gets the event that is fired when the item is used.- Returns:
- the event that is fired when the item is used
-
getLore
Gets the item's lore.- Returns:
- the item's lore
-
getAttributeModifiers
Gets the item's attribute modifiers.- Returns:
- the item's attribute modifiers
-
getEnchantments
Gets the item's enchantments.- Returns:
- the item's enchantments
-
getAllowedEnchantments
@Nullable public @Nullable org.bukkit.enchantments.Enchantment[] getAllowedEnchantments()Gets a list of enchantments that can be applied to the item, this can be used if the base material doesn't allow the enchantment by default.- Returns:
- a list of enchantments that can be applied to the item
-
getForbiddenEnchantments
@Nullable public @Nullable org.bukkit.enchantments.Enchantment[] getForbiddenEnchantments()Gets a list of enchantments that can't be applied to the item, this can be used if the base material allows the enchantment by default.- Returns:
- a list of enchantments that can't be applied to the item
-
canEnchant
public @NonNull net.kyori.adventure.util.TriState canEnchant(@NonNull org.bukkit.enchantments.Enchantment enchantment) -
getItemStack
public @NonNull org.bukkit.inventory.ItemStack getItemStack()Gets the item stack of the item.- Returns:
- the item stack of the item
-