Solved Config.yml keeps clearing on startup.

Discussion in 'Plugin Development' started by man_in_matrix, Aug 6, 2022.

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

    man_in_matrix

    Im making a custom items plugin that reads the item off of the config.yml file (I know its best practice to use a different file but this is a proof of concept for me). However even though I have predefined data in the config.yml in my IDE whenever I start the server its empty.

    Code:
     @Override
        public void onEnable() {
            // Plugin startup logic
            getConfig().options().copyDefaults();
            saveDefaultConfig();
         }
    
    Main class onEnable method

    EDIT: Im using the default config.yml no special file if I wasn't clear from the start.

    EDIT 2: Removing the getConfig().options().copyDefaults(); seemed to fix it
     
    Last edited: Aug 6, 2022
Thread Status:
Not open for further replies.

Share This Page