Magic

Magic

190k Downloads

Inventory broken and overriden

NightScythe1 opened this issue · 13 comments

commented

I run this (amazing) plugin on my server but a few times we've had this issue -
When the server restarts while people are using magic and people join back their survival inventory is replaced with a glitched version of the spell inventory with icons that can be selected and dropped like items. This causes people to lose all their items except their wand and armour. The server is 1.14.4 and plugin is the latest version.

commented

Hi^^
I confirm, if the player is in magic mode during the shutdown of the server or crash server it this problem and will be able to cast the spells on the ground, and the other players will be able to recover them and to learn them! :(
https://zupimages.net/up/19/32/lwad.png
(1.14.4)
@NathanWolf

commented

Are either of you using any kind of inventory saving plugins or maybe something for anti rage-quit that would force this to happen?

I have taken a lot of precautions to prevent this kind of thing, making sure to only save player data with the spell inventory closed, close them on shutdown and logout, etc.

I'll test it again when I can to make sure something hasn't gotten generally broken there, but I am suspecting it's an interaction with some other plugin, maybe?

commented

I don't use special plugins other than CMI

commented

I'm not using anything like that either

commented

Hi, I think that it is the version 1.14 the problem, I didn't have this problem in 1.13...
(it saves inventories and maps slowly ...)

commented

I am having the same issue on 1.14.4 latest papermc.

However, I am also using mv inventories. But not using gamemode inventories. So it's unrelated to that.

I'll look at your source and see if I find anything. My bet is on some async save order weirdness with mv inventories.

commented

@NathanWolf
I traced your save and load. i'm not sure where the save event ordering comes in...

I got very lost in the code and convinced myself it has something to do with the loading process maybe the call plugin.getServer().getScheduler().runTaskLaterAsynchronously(

I noticed that mv inventories uses this.getServer().getScheduler().scheduleSyncDelayedTask(

While it don't pretend to begin to understand this, having only read over it grasping for understanding, is it possible that everynow and then your load task is late and overwrites the loaded mvinventories?

commented

I don’t think Magic has ever worked right with MVInventories. If this issue is a plug-in conflict (does not happen without MVInventories enabled) then it’s unlikely to be fixed, I’m afraid.

commented

@NathanWolf
Well I tried. Do you at least think I got close lol?

Think switching it to scheduleSyncDelayedTask may help?

I just love puzzles lol

commented

https://jd.bukkit.org/org/bukkit/scheduler/BukkitScheduler.html
States Asynchronous tasks should never access any API in Bukkit.

Not sure if it does. but i feel the puzzle getting to me... lol

commented

I typically use PerWorldInventory, but this happens in 1.14.4 even with PWI removed. I've just added a warning before restarts for everyone to close their wands.

commented

I would really love to narrow in on this, but I have not been able to reproduce it at all. I tried using /stop, Control+C and a hard kill -9.

In the first two cases, the wand auto-closes before shutdown.

In the second case it just didn't save the wand as open, because it didn't get a chance to save anything, I guess.

I would love to know if this is a plugin conflict, or maybe something specific with Paper (are you all running Paper). It's a pretty major issue, but I can't fix it unless I can make it happen myself :(

commented

I'm going to close this for now, sorry I was never really able to figure it out. If it's still a big problem, please re-open and let me know.