Waystone name/activation desync on rename
Laike-Endaril opened this issue ยท 5 comments
In multiplayer, if a player renames a waystone, any other players who have previously activated that waystone see the following effects:
Edited name and went from non-global to non-global...
- The waystone visually appears unactivated
- The waystone still appears on the teleport list, but with its old name
- Right clicking or teleporting to the waystone fixes it
Edited name and went from non-global to global...
- The waystone appears on the list twice, once under each name. One entry is global (yellow) and the other is non-global (white)...
...started noticing stranger issues as I continued tests; decided to stop testing and start looking at code.
I will start looking into this and possibly add a PR for it.
Began working on this and was able to alter the behavior, but need to know your preference on some things in order to finish this @blay09
Regarding changing waystones from global -> non-global or non-global -> global...
Situation A: Let's say a waystone starts global and someone changes it to non-global. Which of these should occur?
- The waystone is only activated for the editor (removes all other players' access to the waystone)
- The waystone is activated for all server members up to that point (somewhat removes the point of making it non-global?)
- The waystone is activated only for members who have activated/used it previously (if they never went to it while it was global, they may feel cheated)
Situation B: Next, we have a non-global waystone and 5/15 server members have it activated. Someone makes it global, then makes it non-global again. What should happen?
- The waystone is only activated for the editor (effectively allows editors to remove other members' access)
- The waystone is activated for all server members up to that point
- The waystone is activated only for members who have activated/used it previously
I'm unsure what approach would be best, or if there is an alternative I haven't thought of. Please leave me your thoughts when you get a chance.
Global Waystones are locked to OPs in creative mode (usually set up by server administrators or map makers), so I don't really see the use case for special handling regarding switching from global to non-global or back.
Since things like the activated waystone name are redundantly stored in the player data currently, desyncs are hard to avoid in general, since the rename can only immediately notify players that are online at that moment.
The best solution might be to move to only storing UIDs in the player data, and keeping track of all waystones separately in world data. That way, the waystones list would be accurate 100% of the time and woud even allow for silk-touching waystones to move them. Since this change would either break existing worlds or require conversion code, I think it's best suited to be looked at for the 1.13 port.
If you manage to reproduce #122 or #150, it would be interesting to have a look at the global waystones nbt in the world data, as well as the player data to see what might have gone wrong.
I was concerned about the config option which allows all players to change waystones' "globality", but for now I won't worry about the global -> non-global situations. Mostly because I honestly can't think of a good way to handle them gameplay-wise, to make sure it's not exploitable in some way.
I honestly hadn't considered offline player sync. I suppose it could still be fixed by loading up all player files and editing their tags, but at that point it would be much better to completely change their storage method as you said. Maybe I'll just wait until the 1.13 port is released.
I still haven't actually reproduced #122 or #150; they just seem like they both stem from some form of desync. If I reproduce either one I'll be sure to post all info in their respective threads.
Thanks for the response, and gl on the 1.13 ports!