fix: more tweaks to fix attribute issues

feat/data-edit-commands
William 4 months ago
parent 83b5209a75
commit 845abf370a
No known key found for this signature in database

@ -643,7 +643,11 @@ public abstract class BukkitData implements Data {
instance.setBaseValue(attribute == null ? instance.getDefaultValue() : attribute.baseValue());
instance.getModifiers().forEach(instance::removeModifier);
if (attribute != null) {
attribute.modifiers().stream().distinct().forEach(mod -> instance.addModifier(adapt(mod, plugin)));
attribute.modifiers().stream()
.filter(mod -> instance.getModifiers().stream().map(AttributeModifier::getName)
.noneMatch(n -> n.equals(mod.name())))
.distinct()
.forEach(mod -> instance.addModifier(adapt(mod, plugin)));
}
}

@ -283,7 +283,9 @@ public class Settings {
@Comment({"Which modifiers should not be saved when syncing users. Supports wildcard matching.",
"(e.g. ['minecraft:effect.speed', 'minecraft:effect.*'])"})
@Getter(AccessLevel.NONE)
private List<String> ignoredModifiers = new ArrayList<>(List.of("minecraft:effect.*"));
private List<String> ignoredModifiers = new ArrayList<>(List.of(
"minecraft:effect.*", "minecraft:creative_mode_*"
));
private boolean matchesWildcard(@NotNull String pat, @NotNull String value) {
if (!pat.contains(":")) {

@ -50,6 +50,7 @@ public class Identifier {
Dependency.optional("game_mode")
);
public static final Identifier ATTRIBUTES = huskSync("attributes", true,
Dependency.optional("inventory"),
Dependency.optional("potion_effects")
);
public static final Identifier HEALTH = huskSync("health", true,

Loading…
Cancel
Save