[Solved] Help with basic configuration files.

Discussion in 'Plugin Development' started by Javin, Dec 24, 2011.

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


    I've already been digging around in the Bukkit documentation, but still can't seem to make head's or tails on how the "default" values for the configuration files work.

    I've tried using .AddDefault, but when saving the config files, the values aren't being saved. How do you generate your first generic config file to have all the default values you want?
  2. Offline


    1. final FileConfiguration config = this.getConfig();
    3. config.addDefault("Example.boolean", true);
    4. config.addDefault("Example.String", "example");
    5. config.addDefault("Example.Int", 1);
    7. config.options().copyDefaults(true);
    8. saveConfig();

    You need the config.options().copyDefault(true) with the saveConfig(); otherwise it wont make the config.
    It all goes into your onEnable() aswell
  3. Offline


    Ahhhhhh, copy. Thanks a ton!
  4. Offline


    What about for comments? just add a default string with a # infront of it?
  5. Code:text
    1. this.getConfig().setHeader("Example.boolean","An commant for the Example.boolean node.")
    2. this.getConfig().addHeader("Example.boolean","the next line of it.")

    I gues that was it
Thread Status:
Not open for further replies.

Share This Page