Solved Update config when adding something

Discussion in 'Spigot Plugin Development' started by loidsemus, Jun 6, 2017.

  1. So, my problem is basically that I have a config, with stuff in (I'm only using saveDefaultConfig), but when I add a path to it (to the config.yml in my IDE), export my plugin, and restart the server, that path has not been added to the existing config, and I have to remove the config to update it properly, which obviously I don't want to have to do. Is it supposed to be like this?

    This is probably a pretty nooby question but I don't remember ever having this issue before on any other of my plugins.
     
  2. Well, if you are only using saveDefaultConfig(), then yes I do believe that is what will happen. I use File Configurations which update the config instead of me having to delete it and have it generate again. However, I do have to delete the config sometimes. Usually if I reorganize it or add a lot of new variables.
     
  3. You have to delete the config. This is because the jar will create a new config.yml file if it doesnt exist, else it will simply not delete it and nothing will be updated. However, if you update it without simply changing the config.yml file in your IDE, then it will be updated without having to delete the file. But this is probably not what you're after.
     
  4. Hmm, but how do people release updates to their plugins without forcing people to delete their config then?
     
  5. They keep the same config. Either that or they do as I previously mentioned and edit it in the code onEnable.
     
  6. Sometimes the developers will tell you that you need to delete your config.yml in order for the plugin to work correctly. Like @pvprealm said, some plugins don't need for you to delete your config because nothing was added or removed to it. However, some plugins are amazing and can update everything for you while keeping your settings. Be it, they are rare, they usually involve many different classes and involve custom coded methods.