Solved Adding line to config in code

Discussion in 'Plugin Development' started by Dablakbandit, Dec 6, 2013.

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

    Dablakbandit

    I am wanting the code to add lines into the config if the line doesn't exist and if it does exist to just leave it.

    Thanks in advanced!
    Dablakbandit
     
  2. use the isSet() boolean method to check and see if a path has a value set..
     
  3. Offline

    Dablakbandit

    teozfrank
    Thanks!, now how would i add a string to the config?

    Dablakbandit

    How do i add a line in config from code?

    i have

    Code:
    Worlds:
      world:
        Mobs: True
      world_nether
        Mobs: True
    But how can i add in
    Code:
      world_the_end
        Mobs: True
    Thanks in advanced!
    Dablakbandit

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

    turqmelon

    Code:java
    1.  
    2. getConfig().set("Worlds.world_the_end.Mobs", true);
    3.  
     
    xXMaTTHDXx likes this.
  5. Offline

    Dablakbandit

    turqmelon
    I had already found the answer :), but thanks anyway!
    Dablakbandit
     
Thread Status:
Not open for further replies.

Share This Page