Here is my config file: Code (Text): # MystiqueCore # Version 1.1.2 # The minimum and maximum delay in seconds that a welcome message can be sent to a player Minimum: 2 Maximum: 5 # Anybody with the mystique.welcomeback permission will greet # returning players with these sayings Welcome Sayings: - 'WB :)' - 'wb' - 'welcome back!' - 'Welcome Back!' - 'welcome back :)' - 'Welcome back! :)' # How much to multiply the players bet by for win payout BlackJack Win : 2 # Additional reward if player gets 21 BlackJack 21: .5 # If using permission based win boosters, this value is the maximum boost allowed Max Boost: 5 The config that is generated with the plugin looks like this: Code (Text): # MystiqueCore # Version 1.1.2 # # The minimum and maximum delay in seconds that a welcome message can be sent to a player Minimum: 2 Maximum: 5 Welcome Sayings: - WB :) - wb - welcome back! - Welcome Back! - welcome back :) - Welcome back! :) BlackJack Win: 2 BlackJack 21: 0.5 Max Boost: 5 What am I doing wrong?
Pretty sure if you do it with the built in APIs it's going to remove all comments past the first value. Best option is to save the file yourself.
I explained this here: https://www.spigotmc.org/threads/adding-comments-to-config-via-code.151598/#post-1611269
This is what I'm doing: Code (Text): private void registerConfig() { getConfig().options().copyDefaults(true); saveConfig(); } I call the registerConfig() method in my onEnable
You CAN NOT create comments in the config file except in the header if you create the config file while runtime!
The saveDefaultConfig(); as @MadMaxCookie mentioned will save the config once, and with comments throughout the whole YML.
nc explanation and / or method but you will always keep in your mind that you have to read spigot javadocs.