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:
@@ -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));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user