EnderContainers

EnderContainers

2.5k Downloads

Players are losing Items or get too much (dupe)

R3miiTV opened this issue ยท 3 comments

commented

Versions
ECP Version: 2.2.0 -> https://prnt.sc/wnklkz
Paper Version: 1.16.4 -> https://prnt.sc/wnkly7

Describe the bug
Sometimes items are disapearing in the enderchests for no reason.
Sometimes when a player is removing items from the enderchest and after some time he is open it again, the items are again in the enderchest.

im using mysql

To Reproduce
Random

There are no errors in the console

commented

Hello! Sorry for the long delay.. I never took the time to test all possible cases to reproduce the bug.

BUT TODAY I think I have managed to reproduce it on my local server. It occurs with both MySQL and flat files storage.

HERE IT IS.. basically all players should be disconnected after plugin disabling. That behavior allows the plugin to save all enderchests of connected players when disabling and everything is going well in that case [1]. But in certain situations (when using Spigot restarting feature for example), all players are disconnected right before the plugin disabling.. [2] When a player quits, an asynchronous task is started to save enderchests but as the plugin disables right after.. nothing is saved!

[1] Here is the log when saving items (initial and working case):

[Server thread/INFO]: Stopping the server
[Server thread/INFO]: Stopping server
[Server thread/INFO]: [EnderContainers] Disabling EnderContainers v2.2.1-dev
[Server thread/INFO]: Saving players
[Server thread/INFO]: Utarwyn lost connection: Server closed
[Server thread/INFO]: Utarwyn left the game
[Server thread/INFO]: Saving worlds
[Server thread/INFO]: Saving chunks for level 'ServerLevel[world]'/minecraft:overworld
[Server thread/INFO]: ThreadedAnvilChunkStorage (world): All chunks are saved
[Server thread/INFO]: ThreadedAnvilChunkStorage (world): All chunks are saved

[2] Here is the log when items are not saved (non-working case that can occurs in certain situations):

[Server thread/INFO]: Utarwyn lost connection: Server is restarting
[Server thread/INFO]: Utarwyn left the game
[Server thread/INFO]: Stopping server
[Server thread/INFO]: [EnderContainers] Disabling EnderContainers v2.2.1-dev
[Server thread/INFO]: Saving players
[Server thread/INFO]: Saving worlds
[Server thread/INFO]: Saving chunks for level 'ServerLevel[world]'/minecraft:overworld
[Server thread/INFO]: ThreadedAnvilChunkStorage (world): All chunks are saved
[Server thread/INFO]: ThreadedAnvilChunkStorage (world): All chunks are saved

You can see the difference in the order of events... this is what causes the data saving error. I'll work on that!

commented

@FruitLabCBR can you test with the latest development build to check if my fix is working fine?
You can download it here (can be unstable): https://ci.utarwyn.fr/job/EnderContainers/lastSuccessfulBuild/

commented

I close this issue for now, feel free to reopen it if your problem is not solved! ๐Ÿ‘