9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-31 04:36:45 +00:00

refactor: make attributes allow-listed instead of deny-listed

This is a better default - as a number of attributes are primarily synced through other means (potions, items), or were applied from a context-sensitive action that does not warrant syncing across server contexts (sprinting, flying)
This commit is contained in:
William
2024-09-05 13:37:53 +01:00
parent daaf5147a7
commit 605d314a58
3 changed files with 30 additions and 11 deletions

View File

@@ -571,9 +571,9 @@ public abstract class BukkitData implements Data {
final AttributeSettings settings = plugin.getSettings().getSynchronization().getAttributes();
Registry.ATTRIBUTE.forEach(id -> {
final AttributeInstance instance = player.getAttribute(id);
if (instance == null || Double.compare(instance.getValue(), instance.getDefaultValue()) == 0
|| settings.isIgnoredAttribute(id.getKey().toString())) {
return; // We don't sync unmodified or disabled attributes
if (!settings.isSyncedAttribute(id.getKey().toString()) || instance == null
|| Double.compare(instance.getValue(), instance.getDefaultValue()) == 0) {
return; // We don't sync attributes not marked as to be synced
}
attributes.add(adapt(instance, settings));
});