How do you add comments to yml files without them disappearing on reload?

Discussion in 'Plugin Development' started by shadrxninga, May 20, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    shadrxninga

    I am trying to add comments to help users in my config file but whenever I reload the config file on restart or in game the comments dissapear.
    Is there anyway you can add comments in the code?
    Is there another way to reload the config so the comments stay?

    Here is my reload method

    Code:
         load().load();
             //Load the OPs Name Colors and Prefixes
             opNameColor = load().getString("OP-NameColor", "1");
             opNameColor= opNameColor.replaceAll("&([0-9a-fA-F])","\u00A7$1");
             opMsgColor = load().getString("OP-MsgColor", "1");
             opMsgColor = opMsgColor.replaceAll("&([0-9a-fA-F])","\u00A7$1");
             opPrefix = load().getString("OP-Prefix", "Admin");
             opPrefix = opPrefix.replaceAll("&([0-9a-fA-F])", "\u00A7$1");
            //Load the OPs Name Colors and Prefixes
             playerNameColor = load().getString("Player-NameColor", "&f");
             playerNameColor = playerNameColor.replaceAll("&([0-9a-fA-F])","\u00A7$1");
             playerMsgColor = load().getString("Player-MsgColor", "&f");
             playerMsgColor = playerMsgColor.replaceAll("&([0-9a-fA-F])","\u00A7$1");
             playerPrefix = load().getString("Player-Prefix", "&f");
             playerPrefix = playerPrefix.replaceAll("&([0-9a-fA-F])","\u00A7$1");
             Default = load().getBoolean("Normal Chat", true);
             coloredList = load().getBoolean("Colored Online List", true);
             //save
             load().save();
         }
    Here is my config.yml
    Code:
    OP-NameColor: '&3'
    OP-MsgColor: '&e'
    OP-Prefix: '&2'
    Player-NameColor: '&4'
    Player-MsgColor: '&4'
    Player-Prefix: ''
    Normal Chat: true
    Colored Online List: true
    shadrxninga:
        prefix: '&1[&4Admin&1] '
        name: '&2'
    greeno:
        name: '&2'
     
Thread Status:
Not open for further replies.

Share This Page