Config.yml does not save

Discussion in 'Plugin Development' started by Gamesareme, Jul 6, 2014.

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

    Gamesareme

    I feel like a noob asking this, because so many people have asked before me. Non of their answers help though. The title says it all, my config is not saving. In the config in eclips, I have this.
    Code:
    items:
    - '1'
    - '2'
    - '3'
    - '4'
    When the server starts this apears in the config, all good.
    No when I change it to this.
    Code:
    items:
    - '1'
    - '2'
    - '3'
    - '4'
    - '5'
    when I reload the - '5' does not aper.
    My one enable is this.
    Code:java
    1. public void onEnable()
    2. this.getConfig().options().copyDefaults(true);
    3. this.saveConfig();
    4.  
    5. }

    Sorry again about how many times this question has been asked.
     
  2. Offline

    dsouzamatt

    Gamesareme Try deleting the old config before you reload.
     
  3. Offline

    Gamesareme

    If I do that it will not save my changes.
     
  4. Offline

    dsouzamatt

    Gamesareme Oh, so you're adding a value to the generated config, not the original in Eclipse? Just make sure you're remembering to save it after changing anything and it should work.
     
  5. Offline

    UaVxChallenge

    Switch the two around you are copying the Default Config and then saving giving the original config save it first then load it or just use

    Code:java
    1. this.getConfig();
    2. this.saveConfig();


    Which should also. It works for mine.
     
  6. Offline

    Gamesareme

    It still does not work :(
    on disable, I have
    Code:
    saveConfig();
     
  7. Offline

    Wizehh

    Try this:
    Code:java
    1. saveDefaultConfig();
     
  8. Offline

    UaVxChallenge

    Put this (Put your plugin name where it says PluginNameHere):

    Code:
    public void onEnable(){
     
          Bukkit.getServer().getPluginManager().registerEvents(this, this);
          PluginNameHere.reloadConfig();
          PluginNameHere.saveConfig();
    }
    This should work!:)
     
  9. Offline

    Gamesareme

    Hey thanks it now works. Strang, because I have already tried this. :oops:
     
  10. Offline

    UaVxChallenge

    Gamesareme
    Whose helped? I want to know the answer if it wasn't mine haha
     
  11. Offline

    Gamesareme

    No it was Wizehh. Your one still may work though. :)
     
  12. Offline

    unrealdesign

    Registering an event doesn't do anything lol. Especially if the class doesn't implement Listener like it probably doesn't
     
  13. Offline

    UaVxChallenge

    unrealdesign Most plugins do though because they use multiple sources unless its a small plugin. I have no idea what type of plugin he is making so I assumed that its was going to be a bigger plugin which would need to implement Listener to register all the Java files in it too and my way would be a shortcut for if they were doing it that way.
     
  14. Offline

    unrealdesign

    Well pertaining to his problem, this wasn't necessary is all that I meant.
     
Thread Status:
Not open for further replies.

Share This Page