Open JCox06 opened 2 years ago
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.
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!