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 Details

    • Property

      public Property(AttributeManager.Key key, double value, Collection<org.bukkit.attribute.AttributeModifier> modifiers)
      Create a new property instance.
      Parameters:
      key - of the property
      value - of the property
      modifiers - 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 interface org.bukkit.attribute.AttributeInstance
    • getDefaultValue

      public double getDefaultValue()
      Specified by:
      getDefaultValue in interface org.bukkit.attribute.AttributeInstance
    • getBaseValue

      public double getBaseValue()
      Get the value before modifiers have been applied.
      Specified by:
      getBaseValue in interface org.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 interface org.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 interface org.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 interface org.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 interface org.bukkit.attribute.AttributeInstance
      Returns:
      the resulting attribute value
    • getModifiers

      public Collection<org.bukkit.attribute.AttributeModifier> getModifiers()
      Get all modifiers assigned to this property.
      Specified by:
      getModifiers in interface org.bukkit.attribute.AttributeInstance
      Returns:
      the modifiers of this property
    • getKey

      public AttributeManager.Key getKey()