Skip to content

Editing API Settings

Dalton edited this page Apr 25, 2022 · 8 revisions

Say you don't want a certain module at all to be initialized, not to fear you can enable/disable many feature of the API if you choose to not use them!

In your main class, you're going to be overriding a new method called onPreApiEnable(), from here you get access to the getApiSettings() method like so:

public class PrisonCore extends BurchAPI {

    @Override
    public void onPreApiEnable() {
        this.getApiSettings()
                .useCommandModule(true)
                .useInventoryModule(true)
                .blockCommandFromLoading(TestCommand.class);
    }

    @Override
    public void onPluginEnable() {
        // Plugin startup logic
    }

    @Override
    public void onPluginDisable() {
        // Plugin startup logic
    }

    @Override
    public boolean isDebug() {
        return true;
    }

    @Override
    public String loggerPrefix() {
        return "PrisonCore";
    }
}

You may notice that in the method blockCommandFromLoading(TestCommand.class) the argument taken here is one of your own command class that extends ApiCommand

Clone this wiki locally