Package org.bukkit.attribute
Class AttributeModifier
- java.lang.Object
-
- org.bukkit.attribute.AttributeModifier
-
- All Implemented Interfaces:
ConfigurationSerializable
public class AttributeModifier extends Object implements ConfigurationSerializable
Concrete implementation of an attribute modifier.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AttributeModifier.Operation
Enumerable operation to be applied.
-
Constructor Summary
Constructors Constructor Description AttributeModifier(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)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AttributeModifier
deserialize(Map<String,Object> args)
boolean
equals(Object other)
double
getAmount()
Get the amount by which this modifier will apply itsAttributeModifier.Operation
.String
getName()
Get the name of this modifier.AttributeModifier.Operation
getOperation()
Get the operation this modifier will apply.EquipmentSlot
getSlot()
Get theEquipmentSlot
this AttributeModifier is active on, or null if this modifier is applicable for any slot.UUID
getUniqueId()
Get the unique ID for this modifier.int
hashCode()
Map<String,Object>
serialize()
Creates a Map representation of this class.String
toString()
-
-
-
Constructor Detail
-
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)
-
-
Method Detail
-
getUniqueId
@NotNull public UUID getUniqueId()
Get the unique ID for this modifier.- Returns:
- unique id
-
getName
@NotNull public String 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
@NotNull public AttributeModifier.Operation getOperation()
Get the operation this modifier will apply.- Returns:
- operation
-
getSlot
@Nullable public EquipmentSlot getSlot()
Get theEquipmentSlot
this AttributeModifier is active on, or null if this modifier is applicable for any slot.- Returns:
- the slot
-
serialize
@NotNull public Map<String,Object> 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
-
deserialize
@NotNull public static AttributeModifier deserialize(@NotNull Map<String,Object> args)
-
-