Skip to content
This repository was archived by the owner on Dec 10, 2025. It is now read-only.

Commit aeac183

Browse files
authored
Merge pull request #130 from SLNE-Development/copilot/fix-client-server-sync
Add missing SyncSet client-to-server synchronization
2 parents 8d3ea2d + 3c290fb commit aeac183

File tree

1 file changed

+11
-0
lines changed
  • surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/sync

1 file changed

+11
-0
lines changed

surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/sync/SyncRegistryImpl.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import dev.slne.surf.cloud.core.common.netty.network.protocol.running.SyncSetDel
88
import dev.slne.surf.cloud.core.common.netty.network.protocol.running.SyncValueChangePacket
99
import dev.slne.surf.cloud.core.common.sync.BasicSyncValue
1010
import dev.slne.surf.cloud.core.common.sync.CommonSyncRegistryImpl
11+
import dev.slne.surf.cloud.core.common.sync.SyncSetImpl
1112
import dev.slne.surf.surfapi.core.api.util.logger
1213
import dev.slne.surf.surfapi.core.api.util.mutableObject2LongMapOf
1314
import dev.slne.surf.surfapi.core.api.util.synchronize
@@ -22,6 +23,16 @@ class SyncRegistryImpl : CommonSyncRegistryImpl() {
2223
SyncValueChangePacket(CloudProperties.SERVER_NAME, syncValue).fireAndForget()
2324
}
2425

26+
override fun <T> afterChange(
27+
syncSet: SyncSetImpl<T>,
28+
added: Boolean,
29+
changeId: Long,
30+
element: T
31+
) {
32+
super.afterChange(syncSet, added, changeId, element)
33+
SyncSetDeltaPacket(syncSet, added, changeId, element).fireAndForget()
34+
}
35+
2536
fun applyBatchSyncValue(syncValues: List<Pair<String, Any?>>) {
2637
require(frozen) { "SyncRegistry is not frozen, cannot apply batch" }
2738

0 commit comments

Comments
 (0)