Solved How to put comments on custom config file?

Discussion in 'Spigot Plugin Development' started by bman7842, Jun 10, 2016.

  1. I have a custom ConfigManager class ( http://pastebin.com/TRcZ8sPN ) and I want to add comments to these custom files (Comments as in small notations in the file discussing what specific values do, like # Information). I was wondering if there was any easy way to do it or anyway at all honestly. Resources, wiki links, and examples are much appreciated! Thanks
     
  2. I use plugin.saveResource("file_name_in_jar.yml", false); in the JavaPlugin class. This will copy a file from your jar if it doesn't already exist. You can add comments in a default file, and get the values as you are currently
     
  3. Wow this actually is just what I was looking for, thank you so much.
     
  4. No problem ;)
     
  5. Add how I can get values from this resource? And if I add more paths in config?
     
  6. Code (Java):
    private File file;
    private FileConfiguration config;

    // onEnable
    saveResource("someotheryml.yml", false);
    this.file = new File(getDataFolder(), "someotheryml.yml");
    this.config = YamlConfiguration.loadConfiguration(this.file);