Solved Adding Sections to Config.yml

Discussion in 'Plugin Development' started by Darkpicasa, Aug 27, 2014.

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

    Darkpicasa

    For a config.yml, is there a function that adds a new section to it? Like from
    Code:
    example1: ex1
    example2: ex2
    it becomes
    Code:
    example1: ex1
    example2: ex2
    example3: ex3
    Thanks :)
    -Darkpicasa

    Just a note - the way I'll be using it, the "ex" stuff will be integers.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 10, 2016
  2. Offline

    SmooshCakez

    You could have always tried Google.

    getConfig().set("example3", 47); (Or any other integer, itemstack, string, etc)
    getConfig().createSection("example3");
     
  3. Offline

    Darkpicasa

  4. Offline

    BillyGalbreath

    You have to save to disk. The config is loaded into memory on plugin startup. Changing anything in it only changes whats in memory until you explicitly save it to disk.
     
    Darkpicasa likes this.
  5. Offline

    Darkpicasa

  6. Offline

    BillyGalbreath

    saveConfig()
     
    Darkpicasa likes this.
  7. Offline

    Darkpicasa

    Thanks so much :)
    Now I feel foolish :p
    But yeah, saving it worked :D
     
Thread Status:
Not open for further replies.

Share This Page