Commits
DerFrZocker authored 79c595c0c33
21 21 | private final String name; |
22 22 | private final double amount; |
23 23 | private final Operation operation; |
24 24 | private final EquipmentSlotGroup slot; |
25 25 | |
26 26 | public AttributeModifier( String name, double amount, Operation operation) { |
27 27 | this(UUID.randomUUID(), name, amount, operation); |
28 28 | } |
29 29 | |
30 30 | public AttributeModifier( UUID uuid, String name, double amount, Operation operation) { |
31 - | this(uuid, name, amount, operation, (EquipmentSlotGroup) null); |
31 + | this(uuid, name, amount, operation, (EquipmentSlot) null); |
32 32 | } |
33 33 | |
34 34 | public AttributeModifier( UUID uuid, String name, double amount, Operation operation, EquipmentSlot slot) { |
35 35 | this(uuid, name, amount, operation, (slot) == null ? EquipmentSlotGroup.ANY : slot.getGroup()); |
36 36 | } |
37 37 | |
38 38 | public AttributeModifier( UUID uuid, String name, double amount, Operation operation, EquipmentSlotGroup slot) { |
39 39 | Preconditions.checkArgument(uuid != null, "UUID cannot be null"); |
40 40 | Preconditions.checkArgument(name != null, "Name cannot be null"); |
41 41 | Preconditions.checkArgument(operation != null, "Operation cannot be null"); |
42 + | Preconditions.checkArgument(slot != null, "EquipmentSlotGroup cannot be null"); |
42 43 | this.uuid = uuid; |
43 44 | this.name = name; |
44 45 | this.amount = amount; |
45 46 | this.operation = operation; |
46 47 | this.slot = slot; |
47 48 | } |
48 49 | |
49 50 | /** |
50 51 | * Get the unique ID for this modifier. |
51 52 | * |
88 89 | /** |
89 90 | * Get the {@link EquipmentSlot} this AttributeModifier is active on, |
90 91 | * or null if this modifier is applicable for any slot. |
91 92 | * |
92 93 | * @return the slot |
93 94 | * @deprecated use {@link #getSlotGroup()} |
94 95 | */ |
95 96 | |
96 97 | |
97 98 | public EquipmentSlot getSlot() { |
98 - | return slot.getExample(); |
99 + | return slot == EquipmentSlotGroup.ANY ? null : slot.getExample(); |
99 100 | } |
100 101 | |
101 102 | /** |
102 103 | * Get the {@link EquipmentSlot} this AttributeModifier is active on, |
103 104 | * or null if this modifier is applicable for any slot. |
104 105 | * |
105 106 | * @return the slot |
106 107 | */ |
107 108 | |
108 109 | public EquipmentSlotGroup getSlotGroup() { |