Skip to content
This repository was archived by the owner on Nov 10, 2021. It is now read-only.

Configuration file

Julian edited this page Sep 30, 2016 · 1 revision

You have to create a class which implements ConfigDataInterface for loading the params in your config.

public class ConfigLoader {
    // I did into an inner class for keeping a bit more organized
    public class ConfigDataStore {
        private boolean variable1;

        public void setV1(boolean v1) {
            this.variable1 = v1;
        }

        public boolean isV1() {
            return this.variable1;
        }    
    }

    @Override
    public void loadParams(FileConfiguration fc) { 
        this.setV1(fc.getBoolean("variable1"));
    }
}

In order to get it be loaded correctly, you have to pass an instance of "ConfigLoader" to the init method.

ConfigLoader cLoader = new ConfigLoader();
PluginBase.INSTANCE.init(<Your plugin instance>, cLoader);

Clone this wiki locally