oddlama / vane

Immersive and lore friendly enhancements for vanilla Minecraft
MIT License
276 stars 34 forks source link

[Bug] Vane portals don't save to PersistentStorage #182

Closed tristancamejo closed 1 year ago

tristancamejo commented 1 year ago

Players of my server noticed their vane portals weren't saving since the update to vane v1.10.2.

I glossed over the source code and did a bit of debugging. It looks like the portal gets serialised but not "stored".

image

oddlama commented 1 year ago

Portals are saved in the world's persistent storage NBT, not in the json file. This way portals are bound to their world and don't break when swapping worlds. So what you see is absolutely expected.

This saving mechanism was introduced a long time ago (over a year), and has been working flawlessly since then from what I can tell. It just uses the official Bukkit Persistent Storage API, so if anything isn't actually saved this would be on the server software.

Are you actually experiencing a bug where portals are not loaded?

tristancamejo commented 1 year ago

I'm sure

https://user-images.githubusercontent.com/69066026/209843591-7387d9a7-0a5d-4586-bc56-1e72bcb8f886.mp4

oddlama commented 1 year ago

I see. Your debug prints are definitely in the wrong location, as the portals aren't stored in the json file. Try logging here instead: https://github.com/oddlama/vane/blob/c1376ed7b8a114090f2a327c4facae605bbe92c8/vane-portals/src/main/java/org/oddlama/vane/portals/Portals.java#L962

That function is called when a new world is loaded, and should load the portals. What's alarming is that there already should be a logger in there which I can't see in your output. Actually I can't see any output about loading the world in your video at all... There should be the classic Peparing level "world" message in your log.

https://github.com/oddlama/vane/blob/c1376ed7b8a114090f2a327c4facae605bbe92c8/vane-portals/src/main/java/org/oddlama/vane/portals/Portals.java#L984

This would indicate that the world load event isn't called, but that is very strange. Do you have any additional modifications or plugins that might interfere with world loading in such a way?

You can also try to log here to see when changes are saved: https://github.com/oddlama/vane/blob/c1376ed7b8a114090f2a327c4facae605bbe92c8/vane-portals/src/main/java/org/oddlama/vane/portals/Portals.java#L1029

PS: What version did you upgrade from? And can you reproduce this with just paper + vane and other plugins disabled?

oddlama commented 1 year ago

Maybe try changing POSTWORLD to STARTUP in vane-portals/src/main/resources/plugin.yml. Does that help?

oddlama commented 1 year ago

Yeah that line was introduced recently by a PR and seems problematic, I've removed it for now. Thanks for the heads-up, will publish a hotfix soon :)