Doesnt copy config.yml right.

Discussion in 'Plugin Development' started by mike0631, Jul 11, 2012.

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

    mike0631

    I press f5 to refresh, reloaded server etc.
    But it doesnt come the same as I have it in ecplise.

    What i have in eclipse:
    Code:
    # Mehh
    #
    # Mehh
    fweapon: 283
    # Mehh
    fire: 60
    
    What the output is:
    Code:
    # Mehh
    fweapon: 283
    fire: 60
    
    The piece of code:
    Code:
    getConfig().options().copyDefaults(true);
    saveConfig();
    
    Someone?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 26, 2016
  2. copyDefaults ruins YAML comments, and only saves the comment on the topmost line, if i recall correctly
     
  3. Offline

    mike0631

    Do you know a fix ?
     
  4. Offline

    Sagacious_Zed Bukkit Docs

    mike0631
    There are two different ways to populate a config.yml

    One is to parse the yaml then save with with the saveConfig() method.
    The other is to copy from the jar as is using saveDefaultConfig() method.
     
  5. Offline

    mike0631

    Im just using saveDefaultConfig() now because when releasing i just include the folder with correct config.yml.
    Because I don't know how to use the other.
     
Thread Status:
Not open for further replies.

Share This Page