YAML order

Discussion in 'Plugin Development' started by vildaberper, Mar 12, 2011.

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


    I want to order by keys in config.yml.
    Right now, Im doing this:

    boolean KEY1 = true, KEY2 = true;
    KEY1 = getConfiguration().getBoolean("KEY1", KEY1);
    KEY2 = getConfiguration().getBoolean("KEY2", KEY2);
    config.setProperty("KEY1", KEY1);
    config.setProperty("KEY2", KEY2);

    But that outputs the keys in a random order.
    How do I control this?

    Another thing, is it possible to make comments?
    Something like: config.createComment("Derp");
  2. Offline


    This is an old post, but I want to do the same thing.

    I'm probably gonna prep-end every key/value set by their index.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 11, 2016
  3. Offline


    You can now make a config.yml, compile it into your Jar with everything else, then use saveDefaultConfig() to have it pulled out and saved exactly how you originally created it.
Thread Status:
Not open for further replies.

Share This Page