Package org.bukkit.attribute
Class AttributeModifier
java.lang.Object
org.bukkit.attribute.AttributeModifier
- All Implemented Interfaces:
ConfigurationSerializable
Concrete implementation of an attribute modifier.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enumerable operation to be applied. -
Constructor Summary
ConstructorDescriptionAttributeModifier
(String name, double amount, AttributeModifier.Operation operation) AttributeModifier
(UUID uuid, String name, double amount, AttributeModifier.Operation operation) AttributeModifier
(UUID uuid, String name, double amount, AttributeModifier.Operation operation, EquipmentSlot slot) AttributeModifier
(UUID uuid, String name, double amount, AttributeModifier.Operation operation, EquipmentSlotGroup slot) -
Method Summary
Modifier and TypeMethodDescriptionstatic AttributeModifier
deserialize
(Map<String, Object> args) boolean
double
Get the amount by which this modifier will apply itsAttributeModifier.Operation
.getName()
Get the name of this modifier.Get the operation this modifier will apply.getSlot()
Deprecated.Get theEquipmentSlot
this AttributeModifier is active on, or null if this modifier is applicable for any slot.Get the unique ID for this modifier.int
hashCode()
Creates a Map representation of this class.toString()
-
Constructor Details
-
AttributeModifier
public AttributeModifier(@NotNull String name, double amount, @NotNull AttributeModifier.Operation operation) -
AttributeModifier
public AttributeModifier(@NotNull UUID uuid, @NotNull String name, double amount, @NotNull AttributeModifier.Operation operation) -
AttributeModifier
public AttributeModifier(@NotNull UUID uuid, @NotNull String name, double amount, @NotNull AttributeModifier.Operation operation, @Nullable EquipmentSlot slot) -
AttributeModifier
public AttributeModifier(@NotNull UUID uuid, @NotNull String name, double amount, @NotNull AttributeModifier.Operation operation, @NotNull EquipmentSlotGroup slot)
-
-
Method Details
-
getUniqueId
Get the unique ID for this modifier.- Returns:
- unique id
-
getName
Get the name of this modifier.- Returns:
- name
-
getAmount
public double getAmount()Get the amount by which this modifier will apply itsAttributeModifier.Operation
.- Returns:
- modification amount
-
getOperation
Get the operation this modifier will apply.- Returns:
- operation
-
getSlot
Deprecated.usegetSlotGroup()
Get theEquipmentSlot
this AttributeModifier is active on, or null if this modifier is applicable for any slot.- Returns:
- the slot
-
getSlotGroup
Get theEquipmentSlot
this AttributeModifier is active on, or null if this modifier is applicable for any slot.- Returns:
- the slot
-
serialize
Description copied from interface:ConfigurationSerializable
Creates a Map representation of this class.This class must provide a method to restore this class, as defined in the
ConfigurationSerializable
interface javadocs.- Specified by:
serialize
in interfaceConfigurationSerializable
- Returns:
- Map containing the current state of this class
-
equals
-
hashCode
public int hashCode() -
toString
-
deserialize
-
getSlotGroup()