Package org.bukkit.inventory.meta
Interface Damageable
- All Superinterfaces:
Cloneable
,ConfigurationSerializable
,ItemMeta
,PersistentDataHolder
,PersistentDataViewHolder
Represents an item that has durability and can take damage.
-
Method Summary
Modifier and TypeMethodDescriptionclone()
int
Gets the damageint
Gets the maximum amount of damage.boolean
Checks to see if this item has damage greater than 0.boolean
Checks if any damage value, including 0, is set on this meta.boolean
Checks to see if this item has a maximum amount of damage.void
Clears the damage component from the meta.void
setDamage
(int damage) Sets the damagevoid
setMaxDamage
(@Nullable Integer maxDamage) Sets the maximum amount of damage.Methods inherited from interface org.bukkit.configuration.serialization.ConfigurationSerializable
serialize
Methods inherited from interface org.bukkit.inventory.meta.ItemMeta
addAttributeModifier, addEnchant, addItemFlags, customName, customName, displayName, displayName, getAsComponentString, getAsString, getAttributeModifiers, getAttributeModifiers, getAttributeModifiers, getCanDestroy, getCanPlaceOn, getCustomModelData, getCustomModelDataComponent, getCustomTagContainer, getDamageResistant, getDestroyableKeys, getDisplayName, getDisplayNameComponent, getEnchantable, getEnchantLevel, getEnchantmentGlintOverride, getEnchants, getEquippable, getFood, getItemFlags, getItemModel, getItemName, getJukeboxPlayable, getLocalizedName, getLore, getLoreComponents, getMaxStackSize, getPlaceableKeys, getRarity, getTool, getTooltipStyle, getUseCooldown, getUseRemainder, hasAttributeModifiers, hasConflictingEnchant, hasCustomModelData, hasCustomName, hasDamageResistant, hasDestroyableKeys, hasDisplayName, hasEnchant, hasEnchantable, hasEnchantmentGlintOverride, hasEnchants, hasEquippable, hasFood, hasItemFlag, hasItemModel, hasItemName, hasJukeboxPlayable, hasLocalizedName, hasLore, hasMaxStackSize, hasPlaceableKeys, hasRarity, hasTool, hasTooltipStyle, hasUseCooldown, hasUseRemainder, isFireResistant, isGlider, isHideTooltip, isUnbreakable, itemName, itemName, lore, lore, removeAttributeModifier, removeAttributeModifier, removeAttributeModifier, removeEnchant, removeEnchantments, removeItemFlags, setAttributeModifiers, setCanDestroy, setCanPlaceOn, setCustomModelData, setCustomModelDataComponent, setDamageResistant, setDestroyableKeys, setDisplayName, setDisplayNameComponent, setEnchantable, setEnchantmentGlintOverride, setEquippable, setFireResistant, setFood, setGlider, setHideTooltip, setItemModel, setItemName, setJukeboxPlayable, setLocalizedName, setLore, setLoreComponents, setMaxStackSize, setPlaceableKeys, setRarity, setTool, setTooltipStyle, setUnbreakable, setUseCooldown, setUseRemainder, setVersion
Methods inherited from interface org.bukkit.persistence.PersistentDataHolder
getPersistentDataContainer
-
Method Details
-
hasDamage
boolean hasDamage()Checks to see if this item has damage greater than 0.- Returns:
- true if this has damage > 0
-
getDamage
int getDamage()Gets the damageCall
hasDamageValue()
to be sure a damage value is set.- Returns:
- the damage
-
setDamage
void setDamage(int damage) Sets the damage- Parameters:
damage
- item damage- See Also:
-
hasDamageValue
boolean hasDamageValue()Checks if any damage value, including 0, is set on this meta.- Returns:
- true if any value is set
-
resetDamage
void resetDamage()Clears the damage component from the meta. Differs fromsetDamage(0)
in that it removes the component instead of adding the component with a value of 0. -
hasMaxDamage
boolean hasMaxDamage()Checks to see if this item has a maximum amount of damage.- Returns:
- true if this has maximum amount of damage
-
getMaxDamage
int getMaxDamage()Gets the maximum amount of damage. Plugins should checkhasMaxDamage()
before calling this method.- Returns:
- the maximum amount of damage
-
setMaxDamage
Sets the maximum amount of damage.- Parameters:
maxDamage
- maximum amount of damage
-
clone
-