Tutorial Creating a custom config

Discussion in 'Resources' started by Johny123, Dec 30, 2018.


Did this help you?

Poll closed Jan 23, 2019.
  1. yes

    0 vote(s)
  2. no

Thread Status:
Not open for further replies.
  1. Offline


    I personally have been going around threads on here for like 8 days now not finding how to make your plugin export a yml in the src folder and I finally found it. this has been quite a big problem for me and it is actually really easy to do. -_- So I'm putting the code in here to try and help others with it. I hope this has helped you :)
    getCustomConfig("testFile.yml"); #The line to activate it
    public FileConfiguration getCustomConfig(String name) {
    if (!new File(getDataFolder(), name).exists()) {
       if(getResource(name) != null) {
         saveResource(name, false);
         return YamlConfiguration.loadConfiguration(new File(getDataFolder(), name));
       getLogger().warning("Error, the plugin was NOT able to find the given file (" + name + ")");
    return YamlConfiguration.loadConfiguration(new File(getDataFolder(), name));
    Note that every space has to be 1 tab (if the code moves 1 to the right there has to be 1 tab there)
  2. Offline


    You don't place it in the src folder, you have it inside the Java Project.
Thread Status:
Not open for further replies.

Share This Page