You can have a config.yml file that loads directly from your jar file. It must be added to your project's folder, the same way as the plugin.yml file is.
In this file you have the default values for your configuration.
# This is an YML comment adminName: "Kerooker" moderators: ["Romario", "Pelé", "Cafú"]
The example config file must be added to the project folder.
To load the default configuration file to your plugin's folder, the following code must be added to your onEnable():
This will make your config.yml file from the project to be your plugin's configuration file, and will add it to your plugin's folder.
From there, you can access your config file from anywhere, by using your plugin instance:
JavaPlugin plugin; // Your plugin instance FileConfiguration config = plugin.getConfig(); //Accessing the config file
From there, we can access anything that was set on the plugin's config.
Note: The default config file may have it's values changed, if the user wants to edit the config.yml file generated to the folder.
String adminName = config.getString("adminName"); List<String> moderators = config.getStringList("moderators");