Updating the config.yml

Discussion in 'Spigot Plugin Development' started by DeathNote_15, Jun 15, 2015.

  1. Hey guys,

    So I recently released a plugin. I [might] need to add something in the config.yml, and I've tested adding something to my config, exporting, then reloading my plugin, but anything new I put in the config.yml doesn't show up. I need to delete the plugin folder, regenerate it, and then it shows up. So how do get something I add later on to show up with having users regenerate the plugins folder? Thanks
     
  2. You are using the copydefaults method in the onEnable right? And then making sure to save the config?
     
  3. Yep, thats whats puzzling me
     
  4. Put this on your onEnable()
    Code (Text):
    this.getConfig().addDefault("the.path", "the string")
    and in the end of the addDefaults put this
    Code (Text):
    this.getConfig().options().copyDefaults(true);
    this.saveConfig();
    Not tested yet but still i think it should've work.