Config Comments

Discussion in 'Plugin Development' started by Ravada, May 27, 2015.

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

    Ravada

    Hello,

    When I try and save comments, they do not save at all, as I cannot use saveDefaultConfig(). I'm directly editing the Essential's config file, and saving it by doing config.save(xxxx). How would I get past the comment problem keeping in mind I'm not using the config file that my plugin would create.

    Thanks!
     
  2. Offline

    Zombie_Striker

    Did you even use saveConfig()? Are you using Essentials save feature (I don't mean #save)?
     
  3. Offline

    Ravada

    No I'm using Bukkit's config.save feature. I did save it.

    [​IMG]

    This one.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 12, 2016
  4. Offline

    I Al Istannen

  5. Offline

    Ravada

    So how do I save the config then?
     
  6. Offline

    I Al Istannen

    @Ravada As far as I know you can't really save the config (except default) with comments using the bukkit API. You would have to create your own. Or you could use google "bukkit save config with comments" and look around in the results you get. Im pretty sure you can get sth working with google.

    I don't know any, maybe some other forum user can enlighten us ;)
     
  7. Offline

    caderape

    @Ravada

    I don't think you can add comments. they are deleted when you save your file with your plugin.
    So if you don't store values in your file like esssentials, it should be good. Else, call me if you find a way ;)
     
  8. Offline

    Ravada

    I need to keep the comments, or else they uncomment out some things which are supposed to be commented. Anyone else got any ideas?
     
  9. Offline

    MaTaMoR_

    Try using silkSpawner's config.
     
  10. Offline

    Ravada

  11. Offline

    Zombie_Striker

    @Ravada
    • Create this class in your plugin
    • use CommentedConfigureation()#Method to access methods.
    • Use the save method to save.
     
  12. Offline

    Ravada

    Can you provide me an example with using ComentedConfiguration with a config that isn't in the same project?
     
  13. Offline

    Zombie_Striker

    Code:
    ComConfig config = new ComConfig(new File());
    
    config.save(true);
     
  14. Offline

    VG.Developments

    Well here's what i usually do; put all the information in the header. If you simply do saveDefaultConfig() in your onEnable it will keep comments, until you use saveConfig() which will remove them.
     
  15. Offline

    Ravada

    How do you get it to work if the config file is not the plugin's default one, so you have to edit a different one?
     
  16. Offline

    Ravada

    Don't think it works with different config location?
     
  17. Offline

    caderape

    @Ravada don't save your file with the plugin and it will be good. Ther's no other way
     
  18. Offline

    Ravada

    @caderape I need to save the file with my plugin. That's how it works.
     
  19. Offline

    caderape

  20. Offline

    Ravada

    @caderape I need the comments as some of the comments are required to keep the Essentials config working.
     
  21. Offline

    Konato_K

    @Ravada Call me crazy, but I'm pretty sure comments are not read by the parser, and thus not necessary
     
  22. Offline

    caderape

    @Ravada Essentials dont save the config file by itself. It's a file loaded but not saved. The comments will stay if the save is done by a player while editing the file.
     
  23. Offline

    Ravada

    This is nothing to do with Essentials. I'm saving something into the Essentials config, which removes all the comments for some reason.
     
Thread Status:
Not open for further replies.

Share This Page