diff --git a/bukkit/src/main/java/net/william278/husksync/data/BukkitData.java b/bukkit/src/main/java/net/william278/husksync/data/BukkitData.java index acd3c3e3..13860544 100644 --- a/bukkit/src/main/java/net/william278/husksync/data/BukkitData.java +++ b/bukkit/src/main/java/net/william278/husksync/data/BukkitData.java @@ -643,7 +643,7 @@ public abstract class BukkitData implements Data { instance.setBaseValue(attribute == null ? instance.getDefaultValue() : attribute.baseValue()); instance.getModifiers().forEach(instance::removeModifier); if (attribute != null) { - attribute.modifiers().forEach(mod -> instance.addModifier(adapt(mod, plugin))); + attribute.modifiers().stream().distinct().forEach(mod -> instance.addModifier(adapt(mod, plugin))); } } diff --git a/common/src/main/java/net/william278/husksync/data/Data.java b/common/src/main/java/net/william278/husksync/data/Data.java index cefc5c10..19687391 100644 --- a/common/src/main/java/net/william278/husksync/data/Data.java +++ b/common/src/main/java/net/william278/husksync/data/Data.java @@ -366,7 +366,13 @@ public interface Data { @Override public boolean equals(Object obj) { - return obj instanceof Modifier modifier && modifier.uuid().equals(uuid()); + if (obj instanceof Modifier other) { + if (uuid == null || other.uuid == null) { + return name.equals(other.name); + } + return uuid.equals(other.uuid); + } + return super.equals(obj); } public double modify(double value) {