Save comments in config.yml with spigot / bukkit api

I have a config.yml file with comments like:

#Thats the message when someone joins to the server
Message: Hello User

But when I save the config.yml file and open it again, it disappears and cannot be saved. I tried to find some api for this problem, but could not find that I do not want to use

saveDefaultConfig();

or

getConfig().options.copydefault(true);
saveConfig();

Since I do not want to save this code, I want to save it using api. Which api should i use

+4
source share
2 answers

I would recommend you use the Spigot API, in my opinion this is the best

Both APIs support only one comment in the configuration header section. If you want to save more than one comment, you must encode your own YAMLConfiguration

To keep this title you should try

getConfig().options().header("Your Comment");
getConfig().options().copyHeader(true)

\n

0

config.yml src, . , IDE. , , - saveDefaultConfig(); onEnable(). getConfig() .

0

Source: https://habr.com/ru/post/1695661/


All Articles