Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Items stay in your inventory after server restart when using multi window #65

Closed
Tuchan opened this issue Feb 20, 2024 · 5 comments
Closed

Comments

@Tuchan
Copy link

Tuchan commented Feb 20, 2024

Whenever you use a multi window and the server crashes, the items don't get restored after joining back.

Since the contents are already saved and restored...
note

...would it be possible to serialize and save the player's inventory in a file (maybe datebase even) upon the server close?

private final ItemStack[] playerItems = new ItemStack[36];

This way, whenever a player joins back, it would see if the inventory was restored. If not, deserialize the data and:

private void restorePlayerInventory() {
Inventory inventory = getViewer().getInventory();
for (int i = 0; i < 36; i++) {
inventory.setItem(i, playerItems[i]);
}
}

@Tuchan
Copy link
Author

Tuchan commented Mar 6, 2024

Can still reproduce on v1.26

@NichtStudioCode
Copy link
Owner

Can you send a minimal reproducible example, along with the server software version you're using?

@Tuchan
Copy link
Author

Tuchan commented Apr 2, 2024

Thanks GitHub for giving me a notification............. sorry....
(please ping me next time)

https://pastebin.com/C8iDej2j
server version: paper-1.20.2-318.jar

@NichtStudioCode
Copy link
Owner

@Tuchan
Also works fine for me.
Both stopping the server and letting it be stopped by the watchdog thread call plugin disable, which closes the inventories.

@Tuchan
Copy link
Author

Tuchan commented Apr 2, 2024

Apparently, 3 out of 4 server instances are broken somehow and this feature doesn't work on them, but a completely fresh install of paper is fine. This is a user error. Sorry for the trouble.

Emibergo02 pushed a commit to Emibergo02/InvUI that referenced this issue May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants