Solved Add Default Section to Config

Discussion in 'Plugin Development' started by baenii, Mar 11, 2020.

Thread Status:
Not open for further replies.
  1. Hej!
    Thats not really a Buklit question but more pure Java but anyway:
    As I am more familiar with SQL but not really with configuration files (dont ask why I mentioned this lol), Im currently experiencing a problem.
    Im searching for a way to add defaults like #addDefault(key, value) but for a section. I tried using #createSection(““) but its of course overriding changes everytime the config reloads.
    My config should look like this when first created but should not override changes made for the values on reload!:

    “Section“:
    ‘Key‘: value
    ‘Key‘: value

    Thanks in advance.
     
  2. Offline

    Sensevx

    @baenii

    Check if the section and keys exist? If not make one?

    And, are you sure you are saving the config?
     
    baenii likes this.
  3. Yeah that seems be the solution I need to chose. I thought there would be a shorter solution like there is for the default keys+values (#addDefault(key, value)).

    Yes, I am saving the config.:D

    Thanks!
     
Thread Status:
Not open for further replies.

Share This Page