DragonSurvivalTeam / DragonSurvival

Other
51 stars 39 forks source link

Stop trying to sync player data on login/respawn/dimension change. Only allow reading data from the server in those situations. #469

Closed seelderr closed 6 months ago

seelderr commented 6 months ago

There is an underlying problem here where it is possible for the client to write data to the server before it has read data from the server. This should fix this situation in 99% of cases. However, it is still possible for the client to do an action that requires a sync after logging in but before receiving dragon data from the server, in which case their data will still get lost.

Would be a good idea to extend this fix in the future by explicitly checking if the player has read from the server (or is creating their dragon for the first time) before allowing any writes of dragon data to the server.

fixes #468

Zhusiyuan354 commented 5 months ago

It seems doesn't work well in future version.Sometimes it would still lose players' data.

seelderr commented 1 month ago

This was already reverted a bit later, didn't get mentioned

seelderr commented 1 month ago

See https://github.com/DragonSurvivalTeam/DragonSurvival/blob/1.20.1/src/main/java/by/dragonsurvivalteam/dragonsurvival/common/capability/Capabilities.java

AtlasSniper121 commented 4 weeks ago

There is an underlying problem here where it is possible for the client to write data to the server before it has read data from the server. This should fix this situation in 99% of cases. However, it is still possible for the client to do an action that requires a sync after logging in but before receiving dragon data from the server, in which case their data will still get lost.

Would be a good idea to extend this fix in the future by explicitly checking if the player has read from the server (or is creating their dragon for the first time) before allowing any writes of dragon data to the server.

fixes #468

how do i apply this fix? i see that theres some lines to copy, but where do i paste those?