The problem is that all new lines are completely ignored, so this code returns:
(Where it should output a \n between the lines)
UltimateCore automatically checks for updates from github.com Set this to true if you want to automatically check for updates This won’t download any files
This problem happens for all my config files, and for all nodes in these configs.
The big problem is that after editing a config, and saving it back, it also does not read the comments and saves the config like this:
So this makes it so me updating any value from within my plugin, fucking up the whole config.
This is a pretty high priority issue for me because it stops me from editing my config at all in my plugin.
What could cause this?
How can I fix this?
I a m uncertain, but it could be a problem in typesafe-config. Fire up a quick environment with just that (no configurate), and try reading, editing and saving that file again.
I don’t know how typesafe-config works.
If you could give me a quick example, considering I can’t find a quick start guide, I will try
I could only find this but its pretty long and I can’t find a quick example.
Make sure that your config is on the classpath and is named application.conf.
ConfigFactory.load() loads the config.
Read the comment. Should be config.getConfig(path).origin().comments() if I remember correctly.
Save the file. (or just inspect what it would have saved). You can convert the config to a String by going config.root.render(renderOptions). The render options are gotten using the ConfigRenderOptions class.
Config config = ConfigFactory.load();
config.getConfig(“application.conf”); //I tried both ‘application’ and ‘application.conf’ here
Messages.log(config.root().render(ConfigRenderOptions.defaults()));
Messages.log(config.origin().comments());
Which gave this error:
I finally came up with this code, altough it outputs way more than it should, it works.
This code (Where the application.conf file is the same af the general.conf linked above)
Where at one of the important parts, for example the updater, the comments are intact.
"updater" : {
# application.conf @ jar:file:/C:/Users/Jonathan/Desktop/Projecten/UltimateCore/build/libs/UltimateCore.jar!/application.conf: 22
# UltimateCore automatically checks for updates from github.com
# Set this to true if you want to automatically check for updates
# This won't download any files
"check" : true
}
And config.origin().comments() is an empty list, weirdly enough.
It looks like it formats it correctly. I’d open an issue on Configurate’s bug tracker if nothing else comes up. Also for getting the comments, make sure you’re on the correct node first.
Thanks for looking in to this.
I have no idea how TypeSafe config works (as you could notice in my posts above) but if I can do anything to help/test, message me.
I would really love a solution for this tho, so I can finally update my config from code without breaking everything