Added legacy modifiers

This commit is contained in:
Auxilor
2021-05-01 11:58:18 +01:00
parent a90e0d700e
commit 2e419986e2
2 changed files with 18 additions and 0 deletions

View File

@@ -15,9 +15,16 @@ import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class AttackSpeedTalisman extends Talisman {
private Map<TalismanLevel, AttributeModifier> modifiers;
private final AttributeModifier legacyModifier = new AttributeModifier(
UUID.nameUUIDFromBytes(this.getKey().getKey().getBytes()),
this.getKey().getKey(),
0,
AttributeModifier.Operation.MULTIPLY_SCALAR_1
);
public AttackSpeedTalisman() {
super("attack_speed");
@@ -52,6 +59,8 @@ public class AttackSpeedTalisman extends Talisman {
AttributeModifier modifier = modifiers.get(event.getTalisman());
movementSpeed.removeModifier(legacyModifier);
if (event.getType() == EquipType.EQUIP) {
if (this.getDisabledWorlds().contains(player.getWorld())) {
movementSpeed.removeModifier(modifier);

View File

@@ -14,9 +14,16 @@ import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class SpeedTalisman extends Talisman {
private Map<TalismanLevel, AttributeModifier> modifiers;
private final AttributeModifier legacyModifier = new AttributeModifier(
UUID.nameUUIDFromBytes(this.getKey().getKey().getBytes()),
this.getKey().getKey(),
0,
AttributeModifier.Operation.MULTIPLY_SCALAR_1
);
public SpeedTalisman() {
super("speed");
@@ -51,6 +58,8 @@ public class SpeedTalisman extends Talisman {
AttributeModifier modifier = modifiers.get(event.getTalisman());
movementSpeed.removeModifier(legacyModifier);
if (event.getType() == EquipType.EQUIP) {
if (this.getDisabledWorlds().contains(player.getWorld())) {
movementSpeed.removeModifier(modifier);