Ensure server identity changes trigger full sync

This commit is contained in:
Kam committed 2025-10-19 22:28:03 -04:00
1 parent 0c42fb8128
commit e73b5f3897
4 files changed
+36 -4

No files matched your search

@@ -31,6 +31,7 @@ public class ClientCacheHandler {
public static HashMap<UUID, AnimationData> playerAnimations = new HashMap<>();
private static String activeServerKey = "";
private static String lastServerKey = "";
private static final Map<String, EnumMap<EnumSyncType, Integer>> clientRevisionCache = new HashMap<>();
public static Party party;
@@ -40,9 +41,13 @@ public class ClientCacheHandler {
public static void setActiveServer(String serverKey, EnumMap<EnumSyncType, Integer> serverRevisions) {
String normalizedKey = serverKey == null ? "" : serverKey;
String previousKey = activeServerKey == null ? "" : activeServerKey;
lastServerKey = previousKey;
if (!normalizedKey.equals(activeServerKey)) {
clientRevisionCache.clear();
}
activeServerKey = normalizedKey;
if (activeServerKey.isEmpty()) {
@@ -58,6 +63,10 @@ public class ClientCacheHandler {
}
}
public static String getLastServerKey() {
return lastServerKey == null ? "" : lastServerKey;
}
public static EnumMap<EnumSyncType, Integer> getCachedRevisionsForServer(String serverKey) {
String key = serverKey == null ? "" : serverKey;
if (key.isEmpty()) {