Jikoo / OpenInv

Open anyone's inventory as a chest, real-time!
GNU General Public License v3.0
120 stars 41 forks source link

Improve compatibility with custom NBT #183

Closed Jikoo closed 9 months ago

Jikoo commented 9 months ago

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 by active_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 the ActiveEffects tag, which would likely clobber any data in active_effects next load. This would result in potion effects appearing to not save.

Closes #182