MCPcopy Create free account
hub / github.com/Teneted/Tenet / AttributeModifier

Class AttributeModifier

src/main/java/org/bukkit/attribute/AttributeModifier.java:17–166  ·  view source on GitHub ↗

Concrete implementation of an attribute modifier.

Source from the content-addressed store, hash-verified

15 * Concrete implementation of an attribute modifier.
16 */
17public class AttributeModifier implements ConfigurationSerializable {
18
19 private final UUID uuid;
20 private final String name;
21 private final double amount;
22 private final Operation operation;
23 private final EquipmentSlot slot;
24
25 public AttributeModifier(@NotNull String name, double amount, @NotNull Operation operation) {
26 this(UUID.randomUUID(), name, amount, operation);
27 }
28
29 public AttributeModifier(@NotNull UUID uuid, @NotNull String name, double amount, @NotNull Operation operation) {
30 this(uuid, name, amount, operation, null);
31 }
32
33 public AttributeModifier(@NotNull UUID uuid, @NotNull String name, double amount, @NotNull Operation operation, @Nullable EquipmentSlot slot) {
34 Validate.notNull(uuid, "UUID cannot be null");
35 Validate.notNull(name, "Name cannot be null");
36 Validate.notNull(operation, "Operation cannot be null");
37 this.uuid = uuid;
38 this.name = name;
39 this.amount = amount;
40 this.operation = operation;
41 this.slot = slot;
42 }
43
44 /**
45 * Get the unique ID for this modifier.
46 *
47 * @return unique id
48 */
49 @NotNull
50 public UUID getUniqueId() {
51 return uuid;
52 }
53
54 /**
55 * Get the name of this modifier.
56 *
57 * @return name
58 */
59 @NotNull
60 public String getName() {
61 return name;
62 }
63
64 /**
65 * Get the amount by which this modifier will apply its {@link Operation}.
66 *
67 * @return modification amount
68 */
69 public double getAmount() {
70 return amount;
71 }
72
73 /**
74 * Get the operation this modifier will apply.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected