9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-23 08:39:19 +00:00

feat: add config to skip certain attributes

This commit is contained in:
William
2024-04-10 20:24:27 +01:00
parent 7b8fb92737
commit 8293d767da
3 changed files with 15 additions and 7 deletions

View File

@@ -255,9 +255,6 @@ public class Settings {
@Comment("Persist maps locked in a Cartography Table to let them be viewed on any server")
private boolean persistLockedMaps = true;
@Comment("Whether to synchronize player max health (requires health syncing to be enabled)")
private boolean synchronizeMaxHealth = true;
@Comment("If using the DELAY sync method, how long should this server listen for Redis key data updates before "
+ "pulling data from the database instead (i.e., if the user did not change servers).")
private int networkLatencyMilliseconds = 500;
@@ -273,6 +270,11 @@ public class Settings {
@Getter(AccessLevel.NONE)
private Map<String, String> eventPriorities = EventListener.ListenerType.getDefaults();
@Comment({"For attribute syncing, which attributes should be ignored/skipped when syncing",
"(e.g. \"minecraft:generic.max_health\", \"minecraft:generic.attack_damage\")"})
@Getter(AccessLevel.NONE)
private List<String> ignoredAttributes = new ArrayList<>(List.of(""));
public boolean doAutoPin(@NotNull DataSnapshot.SaveCause cause) {
return autoPinnedSaveCauses.contains(cause.name());
}
@@ -281,6 +283,10 @@ public class Settings {
return id.isCustom() || features.getOrDefault(id.getKeyValue(), id.isEnabledByDefault());
}
public boolean isIgnoredAttribute(@NotNull String attribute) {
return ignoredAttributes.contains(attribute);
}
@NotNull
public EventListener.Priority getEventPriority(@NotNull EventListener.ListenerType type) {
try {