Improve compatibility with custom NBT #183
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Improve compatibility with plugins that add arbitrary NBT. This works by copying the player's old data and writing the current data into it after removing a list of tags that the server is will not clobber if the corresponding internal values are not set. This does make updates marginally more complex, but a good chunk of the save code already needed to be reviewed, so it's not a huge deal.
This will not support ancient data versions - tags are not removed if they no longer exist in a supported version. It is assumed that when you upgrade your server you upgrade your world and players in a reasonable amount of time. In cases where data has not been upgraded in several major versions, it is possible that a very old tag may be preserved and clobber changes made via OI when it is converted into a modern copy.
For example, in 1.20 the tag
ActiveEffects
was replaced byactive_effects
. In 1.21, this will become an unsupported tag due to not having been present in the previous version. If a plugin were to load a player in 1.21 whose data had not been upgraded from the 1.19 format, OI would preserve theActiveEffects
tag, which would likely clobber any data inactive_effects
next load. This would result in potion effects appearing to not save.Closes #182