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

Report: modified config file being overwritten on server restart (not reproducible) #72

Open
crashdemons opened this issue Feb 3, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@crashdemons
Copy link
Owner

This would ease use and reduce issues like meiskam#16

@crashdemons crashdemons added the enhancement New feature or request label Feb 3, 2021
@crashdemons
Copy link
Owner Author

crashdemons commented Feb 7, 2021

I thought that when the plugin shuts down it saved the config, but it seems like this is a myth?

When I tried to reproduce this I could not.
I changed the config when the server was not running and loaded it: the loaded config had the values.
I changed the config while the server was running and restarted the server: the config file was not overwrriten and properly loaded the values set in it.

When I check the current code, the config is NOT saved on shutdown, and there are only three cases when it is saved:

  • when the config does not exist on startup, it is recreated from defaults (standard saveDefaultConfig)
  • when /ph config set <key> command is used
  • when /ph config set <key> <value> command is used.

https://github.com/crashdemons/PlayerHeads/blob/0e957344d38cab652371f20bd5c5ca88d245dda4/PlayerHeads-core/src/main/java/org/shininet/bukkit/playerheads/PlayerHeads.java

So the config should never overwrite except when using config commands ingame.

This would make sense if it was old behavior but checking old code from Dragoboss (3.x-min) seems to imply it wasn't an issue then either.
https://github.com/Dragoboss/PlayerHeads/blob/b92503f7f2e92ed44107e639e39b2a66354c4ed4/src/main/java/org/shininet/bukkit/playerheads/PlayerHeads.java

So, was this ever an issue? people certainly complained about it and I always assumed it was the case - but there is no evidence it ever was.

@crashdemons
Copy link
Owner Author

Checking the code in 5.2.3 with JD (around the time of the original Issue), there is also no code forcing a save on shutdown.
So nothing seems to have changed since 3.x

@crashdemons crashdemons changed the title Implement 'dirty' check on config to prevent overwriting file changes on disable (or similar fix) Report: modified config file being overwritten on server restart (not reproducible) Feb 7, 2021
@crashdemons crashdemons added bug Something isn't working and removed enhancement New feature or request labels Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant