Solved addDefault Not Adding to Config

Discussion in 'Plugin Development' started by Zach_1919, Aug 10, 2013.

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

    Zach_1919

    I am making a revamped factions plugin, and I have it so when someone creates a faction, it adds their faction to the config, along with all the information that goes along with it. I want it to be put into the config like this:
    PHP:
    WhateverFaction:
      
    LeaderZach_1919
      Officers
    :
      
    Members:
      
    Chunks:
      
    Password:
      
    Warps:
      
    Homeworld,130,10,139
    In order to do this, I do the addDefault method for each one, like this:
    Code:java
    1. getConfig().addDefault("WhateverFaction.Leader",player.getName());


    I also save afterwards:
    Code:java
    1. saveConfig();


    The weird part is, when I create a faction, it is supposed to add the information to the config, then when a new Faction object is created, it pulls its own information from the config, and loads it into that Faction object. So the Faction object is able to pull the information from the config when it doesn't really show up, then when I reload, the Faction object can no longer access the information.
     
  2. Offline

    gomeow

    Why are you using addDefault? Just use set for something like that
     
  3. Offline

    Zach_1919

    gomeow Wow...I don't even know...thank you
     
Thread Status:
Not open for further replies.

Share This Page