Lines of comments (#) in config

Discussion in 'Spigot Plugin Development' started by --TOMAS--, May 13, 2016.

  1. I need help with something.
    I have this code for config. And I want to add lines of comments (EG: #This string is ...), how do I do?

    Code (Text):
    config.addDefault("Messages.onJoinMessage", "&e%player% &7joined the game!");
     
  2. create your own config method, dont use the defaulkt one
     
  3. You can't do it through the config API, you need to actually change the file. I think there was someone working on an API for adding comments in a config file based on a key so let me see if I can find it.

    @--TOMAS-- I don't think this was the one I remember but never the less it looks great and it seems the following for it is still active as is the dev.
    https://www.spigotmc.org/resources/yamler.315/
     
    #3 MrBlobman, May 13, 2016
    Last edited: May 13, 2016
    • Like Like x 1
  4. Well, in you find it, send PM
     
  5. use saveDefaultConfig() method in onEnable to do it.
    With this method, you need to create config.yml right in your path where plugin.yml exists
    Type all vars with comments
    PROFIT
     
  6. Thanks you!
     
    • Like Like x 1
  7. If you want a detailed tutorial, I made one here. :) Configs are really very, very simple.