According to the latest open tickets, there seem to be several cases of lost data. Under normal circumstances, the default option of saving data when the player logs out is sufficient, and avoids putting too much strain on the hard disk. However, in certain configurations, the server may crash (this is not normal), resulting in data loss.
To ensure that the plugin is suitable for everyone, an additional save mode has already been added on inventory closure. In this case, the plugin will make much greater use of disk and CPU.
Another solution has been proposed: save the chests at the same time as the world. This could be the most "balanced" and effective solution. Note, however, that the enderchest is not linked to a world, so there may be several successive saves if you have several worlds. This PR proposes this experiment with a new configuration.
Changes
Add a new configuration named "saveMode" which can have values logout (default), on-close or world-save
Do containers update in the main thread to avoid data inconsistency
Related Issues
Replaces #231
Resolves #130
Checklist
[x] I have fully tested the proposed changes and promise that they will not break everything into chaos.
[x] I followed the existing code standards and didn't mess up the formatting.
[x] I did my best to add documentation to any public classes or methods I added.
Description
According to the latest open tickets, there seem to be several cases of lost data. Under normal circumstances, the default option of saving data when the player logs out is sufficient, and avoids putting too much strain on the hard disk. However, in certain configurations, the server may crash (this is not normal), resulting in data loss.
To ensure that the plugin is suitable for everyone, an additional save mode has already been added on inventory closure. In this case, the plugin will make much greater use of disk and CPU.
Another solution has been proposed: save the chests at the same time as the world. This could be the most "balanced" and effective solution. Note, however, that the enderchest is not linked to a world, so there may be several successive saves if you have several worlds. This PR proposes this experiment with a new configuration.
Changes
logout
(default),on-close
orworld-save
Related Issues
Replaces #231 Resolves #130
Checklist
🙏 Thanks to @Kamesuta for his work on the feature