Package org.bukkit.attribute
Class AttributeModifier
java.lang.Object
org.bukkit.attribute.AttributeModifier
- All Implemented Interfaces:
net.kyori.adventure.key.Keyed,ConfigurationSerializable,Keyed
Concrete implementation of an attribute modifier.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumerable operation to be applied. -
Constructor Summary
ConstructorsConstructorDescriptionAttributeModifier(@NotNull String name, double amount, @NotNull AttributeModifier.Operation operation) Deprecated, for removal: This API element is subject to removal in a future version.AttributeModifier(@NotNull UUID uuid, @NotNull String name, double amount, @NotNull AttributeModifier.Operation operation) Deprecated, for removal: This API element is subject to removal in a future version.AttributeModifier(@NotNull UUID uuid, @NotNull String name, double amount, @NotNull AttributeModifier.Operation operation, @NotNull EquipmentSlotGroup slot) Deprecated, for removal: This API element is subject to removal in a future version.AttributeModifier(@NotNull UUID uuid, @NotNull String name, double amount, @NotNull AttributeModifier.Operation operation, @Nullable EquipmentSlot slot) Deprecated, for removal: This API element is subject to removal in a future version.AttributeModifier(@NotNull NamespacedKey key, double amount, @NotNull AttributeModifier.Operation operation) AttributeModifier(@NotNull NamespacedKey key, double amount, @NotNull AttributeModifier.Operation operation, @NotNull EquipmentSlotGroup slot) -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull AttributeModifierdeserialize(@NotNull Map<String, Object> args) booleandoubleGet the amount by which this modifier will apply itsAttributeModifier.Operation.@NotNull NamespacedKeygetKey()Return the namespaced identifier for this object.@NotNull StringgetName()Get the name of this modifier.@NotNull AttributeModifier.OperationGet the operation this modifier will apply.@Nullable EquipmentSlotgetSlot()Deprecated.@NotNull EquipmentSlotGroupGet theEquipmentSlotGroupthis AttributeModifier is active on.@NotNull UUIDDeprecated, for removal: This API element is subject to removal in a future version.attributes are now identified by keysinthashCode()Creates a Map representation of this class.toString()
-
Constructor Details
-
AttributeModifier
@Deprecated(since="1.21", forRemoval=true) public AttributeModifier(@NotNull @NotNull String name, double amount, @NotNull @NotNull AttributeModifier.Operation operation) Deprecated, for removal: This API element is subject to removal in a future version. -
AttributeModifier
@Deprecated(since="1.21", forRemoval=true) public AttributeModifier(@NotNull @NotNull UUID uuid, @NotNull @NotNull String name, double amount, @NotNull @NotNull AttributeModifier.Operation operation) Deprecated, for removal: This API element is subject to removal in a future version. -
AttributeModifier
@Deprecated(since="1.21", forRemoval=true) public AttributeModifier(@NotNull @NotNull UUID uuid, @NotNull @NotNull String name, double amount, @NotNull @NotNull AttributeModifier.Operation operation, @Nullable @Nullable EquipmentSlot slot) Deprecated, for removal: This API element is subject to removal in a future version. -
AttributeModifier
@Deprecated(since="1.21", forRemoval=true) public AttributeModifier(@NotNull @NotNull UUID uuid, @NotNull @NotNull String name, double amount, @NotNull @NotNull AttributeModifier.Operation operation, @NotNull @NotNull EquipmentSlotGroup slot) Deprecated, for removal: This API element is subject to removal in a future version. -
AttributeModifier
public AttributeModifier(@NotNull @NotNull NamespacedKey key, double amount, @NotNull @NotNull AttributeModifier.Operation operation) -
AttributeModifier
public AttributeModifier(@NotNull @NotNull NamespacedKey key, double amount, @NotNull @NotNull AttributeModifier.Operation operation, @NotNull @NotNull EquipmentSlotGroup slot)
-
-
Method Details
-
getUniqueId
Deprecated, for removal: This API element is subject to removal in a future version.attributes are now identified by keysGet the unique ID for this modifier.- Returns:
- unique id
- See Also:
-
getKey
Description copied from interface:KeyedReturn the namespaced identifier for this object. -
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 theEquipmentSlotthis AttributeModifier is active on, or null if this modifier is applicable for any slot.- Returns:
- the slot
-
getSlotGroup
Get theEquipmentSlotGroupthis AttributeModifier is active on.- Returns:
- the slot
-
serialize
Description copied from interface:ConfigurationSerializableCreates a Map representation of this class.This class must provide a method to restore this class, as defined in the
ConfigurationSerializableinterface javadocs. nb: It is not intended for this method to be called directly, this will be called by theConfigurationSerializationclass.- Specified by:
serializein interfaceConfigurationSerializable- Returns:
- Map containing the current state of this class
-
equals
-
hashCode
public int hashCode() -
toString
-
deserialize
@NotNull public static @NotNull AttributeModifier deserialize(@NotNull @NotNull Map<String, Object> args)
-
getSlotGroup()