NichtStudioCode / InvUI

A spigot library for creating custom inventory-based GUIs.
MIT License
253 stars 20 forks source link

Items saved in player inventory on server crash. #84

Open NicoNekoDev opened 3 months ago

NicoNekoDev commented 3 months ago

If a server crashes while a player have a split window open, the items remains in their inventory.

Steps to reproduce: 1) create a split window, fill the bottom with items, and open it 2) go to console and do a /save-all (keep the gui open!) 3) crash the server (keep the gui open!) - one way is killing the java process manually

What is observed is that after the restart, the player has the gui items in their inventory and they can play with them. Also, their previous inventory is not restored, so RIP items if the player has any.

NichtStudioCode commented 3 months ago

I am aware of this problem. Outside of forcefully terminating the process this shouldn't happen though, as the server still disables the plugin in the case of a crash (unhandled exception / watchdog thread terminating the server).

I may look into making inventories completely packet-based in the future to fix these issues, but that would be in a v2 of InvUI without multi-version support.

NicoNekoDev commented 3 months ago

One other way is to store the player inventory under a namespace key in their persistent data container, and restore the inventory if that key is present when the player joins the server again. Or at least that's how I would implemented it. However, there's no persistent data container under version 1.16.