You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 18, 2022. It is now read-only.
Describe the bug
The config.yml comments are discarded when the file is exported into the plugin's directory folder.
This makes it harder to understand the config parameters.
To Reproduce
Steps to reproduce the behavior:
Install plugin for first time and check config.yml
Minecraft version
1.17.1
Expected behavior
That the config file contains information about the settings for the plugin.
Additional context
This appears to be an issue in the config manager when calling JavaPlugin#saveConfig().
Calling JavaPlugin#saveDefaultConfig() instead will export the whole file if it is not already there including comments. However, in the constructor of ConfigManager, removing the range based for loop and replacing it with JavaPlugin#setDefaultConfig() will mean when the plugin updates, missing keys will not be added to the config file.
So I suppose it depends on what functionality you want in the plugin. I don't think there is a way to allow both as updating the config will remove all comments.
I wonder if there is a way to preserve comments while still updating the configuration file.
If this is something you want changing I don't mind working on the Pull Request.
Thank you!
The text was updated successfully, but these errors were encountered:
Hi, this is obviously something that would be very useful for everyone. I don't currently have much time to do this myself but if you submitted a pull request I would definitely look at it. I think I recall md5 saying something about making it so comments will always stay in a future update. Thanks.
It seems quite challenging to include both functionality. I'll defiantly take a look although I don't know how long it will be until I can get a pull request to you.
Thanks.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the bug
The config.yml comments are discarded when the file is exported into the plugin's directory folder.
This makes it harder to understand the config parameters.
To Reproduce
Steps to reproduce the behavior:
Minecraft version
1.17.1
Expected behavior
That the config file contains information about the settings for the plugin.
Additional context
This appears to be an issue in the config manager when calling JavaPlugin#saveConfig().
Calling JavaPlugin#saveDefaultConfig() instead will export the whole file if it is not already there including comments. However, in the constructor of ConfigManager, removing the range based for loop and replacing it with JavaPlugin#setDefaultConfig() will mean when the plugin updates, missing keys will not be added to the config file.
So I suppose it depends on what functionality you want in the plugin. I don't think there is a way to allow both as updating the config will remove all comments.
I wonder if there is a way to preserve comments while still updating the configuration file.
If this is something you want changing I don't mind working on the Pull Request.
Thank you!
The text was updated successfully, but these errors were encountered: