Package org.bukkit.attribute
Interface AttributeInstance
public interface AttributeInstance
Represents a mutable instance of an attribute and its associated modifiers
 and values.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddModifier(@NotNull AttributeModifier modifier) Add a modifier to this instance.voidaddTransientModifier(@NotNull AttributeModifier modifier) Add a transient modifier to this instance.The attribute pertaining to this instance.doubleBase value of this instance before modifiers are applied.doubleGets the default value of the Attribute attached to this instance.getModifier(UUID uuid) Deprecated, for removal: This API element is subject to removal in a future version.getModifier(Key key) Gets the modifier with the corresponding key.Get all modifiers present on this instance.doublegetValue()Get the value of this instance after all associated modifiers have been applied.voidremoveModifier(UUID uuid) Deprecated, for removal: This API element is subject to removal in a future version.useremoveModifier(net.kyori.adventure.key.Key), modifiers are no longer stored by UUIDvoidremoveModifier(Key key) Remove a modifier with the corresponding key from this instance.voidremoveModifier(@NotNull AttributeModifier modifier) Remove a modifier from this instance.voidsetBaseValue(double value) Set the base value of this instance.
- 
Method Details- 
getAttributeThe attribute pertaining to this instance.- Returns:
- the attribute
 
- 
getBaseValuedouble getBaseValue()Base value of this instance before modifiers are applied.- Returns:
- base value
 
- 
setBaseValuevoid setBaseValue(double value) Set the base value of this instance.- Parameters:
- value- new base value
 
- 
getModifiersGet all modifiers present on this instance.- Returns:
- a copied collection of all modifiers
 
- 
getModifierGets the modifier with the corresponding key.- Parameters:
- key- the jey of the modifier
- Returns:
- the modifier, if it exists
 
- 
removeModifierRemove a modifier with the corresponding key from this instance.- Parameters:
- key- the key of the modifier
 
- 
getModifier@Deprecated(forRemoval=true, since="1.21") @Nullable @Nullable AttributeModifier getModifier(@NotNull UUID uuid) Deprecated, for removal: This API element is subject to removal in a future version.usegetModifier(net.kyori.adventure.key.Key), modifiers are no longer stored by UUIDGets the modifier with the corresponding UUID.- Parameters:
- uuid- the UUID of the modifier
- Returns:
- the modifier, if it exists
 
- 
removeModifierDeprecated, for removal: This API element is subject to removal in a future version.useremoveModifier(net.kyori.adventure.key.Key), modifiers are no longer stored by UUIDRemove a modifier with the corresponding UUID from this instance.- Parameters:
- uuid- the UUID of the modifier
 
- 
addModifierAdd a modifier to this instance.- Parameters:
- modifier- to add
 
- 
addTransientModifierAdd a transient modifier to this instance. Transient modifiers are not persisted (saved with the NBT data)- Parameters:
- modifier- to add
 
- 
removeModifierRemove a modifier from this instance.- Parameters:
- modifier- to remove
 
- 
getValuedouble getValue()Get the value of this instance after all associated modifiers have been applied.- Returns:
- the total attribute value
 
- 
getDefaultValuedouble getDefaultValue()Gets the default value of the Attribute attached to this instance.- Returns:
- server default value
 
 
- 
getModifier(net.kyori.adventure.key.Key), modifiers are no longer stored by UUID