Config Comments

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

Thread Status:
Not open for further replies.
  1. 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 How would I get past the comment problem keeping in mind I'm not using the config file that my plugin would create.

  2. Offline


    Did you even use saveConfig()? Are you using Essentials save feature (I don't mean #save)?
  3. No I'm using Bukkit's feature. I did save it.


    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. 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



    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. 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. Try using silkSpawner's config.
  10. Offline


    • Create this class in your plugin
    • use CommentedConfigureation()#Method to access methods.
    • Use the save method to save.
  11. Can you provide me an example with using ComentedConfiguration with a config that isn't in the same project?
  12. Offline


    ComConfig config = new ComConfig(new File());;
  13. Offline


    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.
  14. 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?
  15. Don't think it works with different config location?
  16. Offline


    @Ravada don't save your file with the plugin and it will be good. Ther's no other way
  17. @caderape I need to save the file with my plugin. That's how it works.
  18. Offline


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


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


    @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.
  22. 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