mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 05:27:37 +00:00
Ensure server identity changes trigger full sync
This commit is contained in:
1 parent
0c42fb8128
commit
e73b5f3897
4 files changed
+36
-4
No files matched your search
@@ -133,14 +133,26 @@ public class SyncController {
|
||||
public static void handleClientRevisionReport(
|
||||
EntityPlayerMP player,
|
||||
String serverKey,
|
||||
String previousServerKey,
|
||||
Map<EnumSyncType, Integer> clientRevisions
|
||||
) {
|
||||
if (!getServerCacheKey().equals(serverKey)) {
|
||||
String currentServerKey = getServerCacheKey();
|
||||
PlayerSyncState state = PLAYER_SYNC_STATE.computeIfAbsent(player.getUniqueID(), PlayerSyncState::new);
|
||||
|
||||
if (!currentServerKey.equals(serverKey)) {
|
||||
state.reset();
|
||||
syncPlayer(player);
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerSyncState state = PLAYER_SYNC_STATE.computeIfAbsent(player.getUniqueID(), PlayerSyncState::new);
|
||||
if (!currentServerKey.isEmpty()) {
|
||||
if (previousServerKey == null || !currentServerKey.equals(previousServerKey)) {
|
||||
state.reset();
|
||||
syncPlayer(player);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
state.applyHandshake(clientRevisions);
|
||||
|
||||
syncPlayer(player);
|
||||
@@ -959,5 +971,9 @@ public class SyncController {
|
||||
revisions.putAll(incoming);
|
||||
}
|
||||
|
||||
private synchronized void reset() {
|
||||
revisions.clear();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user