Package net.glowstone.entity
Class AttributeManager.Property
java.lang.Object
net.glowstone.entity.AttributeManager.Property
- All Implemented Interfaces:
org.bukkit.attribute.AttributeInstance
- Enclosing class:
- AttributeManager
public class AttributeManager.Property
extends Object
implements org.bukkit.attribute.AttributeInstance
-
Constructor Summary
ConstructorDescriptionProperty
(AttributeManager.Key key, double value, Collection<org.bukkit.attribute.AttributeModifier> modifiers) Create a new property instance.Property
(AttributeManager.Key key, double value, Map<UUID, org.bukkit.attribute.AttributeModifier> modifiers, double cachedValue, boolean isCacheUpToDate) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addModifier
(org.bukkit.attribute.AttributeModifier attributeModifier) Add a modifier to this property.org.bukkit.attribute.Attribute
double
Get the value before modifiers have been applied.double
getKey()
Collection<org.bukkit.attribute.AttributeModifier>
Get all modifiers assigned to this property.double
getValue()
Get value of this property after all modifiers have been applied.void
removeModifier
(org.bukkit.attribute.AttributeModifier attributeModifier) Remove an attribute from this property.void
setBaseValue
(double value) Set the base value on which modifiers are applied.
-
Constructor Details
-
Property
public Property(AttributeManager.Key key, double value, Collection<org.bukkit.attribute.AttributeModifier> modifiers) Create a new property instance.- Parameters:
key
- of the propertyvalue
- of the propertymodifiers
- of the property
-
Property
public Property(AttributeManager.Key key, double value, Map<UUID, org.bukkit.attribute.AttributeModifier> modifiers, double cachedValue, boolean isCacheUpToDate)
-
-
Method Details
-
getAttribute
public org.bukkit.attribute.Attribute getAttribute()- Specified by:
getAttribute
in interfaceorg.bukkit.attribute.AttributeInstance
-
getDefaultValue
public double getDefaultValue()- Specified by:
getDefaultValue
in interfaceorg.bukkit.attribute.AttributeInstance
-
getBaseValue
public double getBaseValue()Get the value before modifiers have been applied.- Specified by:
getBaseValue
in interfaceorg.bukkit.attribute.AttributeInstance
- Returns:
- base value
-
setBaseValue
public void setBaseValue(double value) Set the base value on which modifiers are applied.- Specified by:
setBaseValue
in interfaceorg.bukkit.attribute.AttributeInstance
- Parameters:
value
- new base value
-
addModifier
public void addModifier(org.bukkit.attribute.AttributeModifier attributeModifier) Add a modifier to this property.Attributes with the same uuid will be overridden according to https://minecraft.gamepedia.com/Attribute#Attributes
- Specified by:
addModifier
in interfaceorg.bukkit.attribute.AttributeInstance
- Parameters:
attributeModifier
- to add to this property
-
removeModifier
public void removeModifier(org.bukkit.attribute.AttributeModifier attributeModifier) Remove an attribute from this property.- Specified by:
removeModifier
in interfaceorg.bukkit.attribute.AttributeInstance
- Parameters:
attributeModifier
- to remove from this property
-
getValue
public double getValue()Get value of this property after all modifiers have been applied.- Specified by:
getValue
in interfaceorg.bukkit.attribute.AttributeInstance
- Returns:
- the resulting attribute value
-
getModifiers
Get all modifiers assigned to this property.- Specified by:
getModifiers
in interfaceorg.bukkit.attribute.AttributeInstance
- Returns:
- the modifiers of this property
-
getKey
-