Solved How to make a config file for a bungeecord plugin?

Discussion in 'BungeeCord Plugin Development' started by AA12YT, Jun 23, 2022.

  1. I am kind of new to making bungeecord plugins. I tried making a config with a tutorial i copied the code and it ended up having about 14 errors. So i am looking for a way to make a config on the latest bungeecord version.
    Please help me.
  2. I tried it but couldn't manage to do it. But i got support from a really nice guy so I did it. Thanks anyway!
  3. You'll have to work with the following classes: ConfigurationProvider and YamlConfiguration

    You can start the development with the following:

    Code (Java):
    // create a config from an existing File. Note that you'll have to manually create the file which the plugin can then use
    configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(file);

    // you can then use the object "configuration" from previous lines

    // and when you want to save the config
    ConfigurationProvider.getProvider(YamlConfiguration.class).save(configuration, file);
    You will have to manage the file class by hand unfortunately. By switching the YamlConfiguration.class to another class you can have different types of configurations. imo its good to keep the configuration loaded in memory so you won't have to keep reloading it from the disk