tpwalke2 / BlueMapSignMarkers

Fabric plugin for BlueMap that displays markers based on in-game signs
MIT License
2 stars 2 forks source link

config gets overwritten #69

Closed jaceee closed 3 months ago

jaceee commented 3 months ago

Every time I restart my fabric server the default config replaces my config

tpwalke2 commented 3 months ago

Which version of Minecraft are you using?

Would you be able to attach your config file and a log file that shows the server startup?

elboletaire commented 3 months ago

Every time I restart my fabric server the default config replaces my config

Uh, yeah, I also noticed that. You have to stop the server, then do changes, then boot it up again. When shutting the server down the mod always rewrites the file.

tpwalke2 commented 3 months ago

@jaceee, can you confirm that you are encountering similar behavior as @elboletaire where you edit the config while the server is running but then shutting down the server overwrites the changes?

elboletaire commented 3 months ago

@jaceee, can you confirm that you are encountering similar behavior as @elboletaire where you edit the config while the server is running but then shutting down the server overwrites the changes?

I think it's expected, considering the config is being overwritten on shutdown: https://github.com/tpwalke2/BlueMapSignMarkers/blob/main/src/main/java/com/tpwalke2/bluemapsignmarkers/BlueMapSignMarkersMod.java#L34

The actual problem is not the settings being overwritten in that point, but the fact that they get overwritten with the data on memory, rather than trying to read the file first to see if there are any changes, so that makes the file always look as the server was first boot up.

If the mod had some way to reload its config on game, I'd do that just before shutting it down. If there's some way to add this as a callback/event of bluemap's reload function, it would be a good idea to link this reload logic to the bluemap one too (just to avoid having to create commands for this mod).

edit: or maybe just stop saving on shutdown? 🤔

tpwalke2 commented 3 months ago

Yeah, I think not saving on shutdown would be the simplest approach.

tpwalke2 commented 3 months ago

@jaceee, @elboletaire, I have merged the PR (https://github.com/tpwalke2/BlueMapSignMarkers/pull/75) for this update to main. The mod will only save the config during the load if a config file is not present (new installations) or if there is an upgrade migration from a previous config version.

There are a few other items I am targeting for the same version (1.21-0.4.0), however. You can track the progress of those issues here: https://github.com/tpwalke2/BlueMapSignMarkers/issues?q=is%3Aissue+is%3Aopen+label%3A1.21-0.4.0

tpwalke2 commented 2 months ago

@jaceee, @elboletaire, I have published a release to modrinth that contains this update: https://modrinth.com/mod/bluemap-sign-markers/version/1.21-0.4.0.30

elboletaire commented 2 months ago

@jaceee, @elboletaire, I have published a release to modrinth that contains this update: modrinth.com/mod/bluemap-sign-markers/version/1.21-0.4.0.30

Will try it as soon as I get out of office!

edit: ok, I forgot yesterday... will try today 😅

elboletaire commented 2 months ago

@jaceee, @elboletaire, I have published a release to modrinth that contains this update: modrinth.com/mod/bluemap-sign-markers/version/1.21-0.4.0.30

Sadly, I can't try yet, since my server is stuck on version 1.20.6 due to mods that still haven’t received updates 😢