Skip to content

You main class and you

Dalton edited this page Apr 25, 2022 · 3 revisions

Your main class when using our API is slightly transformed, but do not worry! This will not have any performance impacts on your server and you will not need to reconfigure anything else for your plugin, everything else stays the same even your plugin.yml

Your main class should extend BurchAPI instead of your conventional JavaPlugin (BurchAPI is a type of JavaPlugin)

public class YourMainClass extends BurchAPI {


    @Override
    public void onPluginEnable() {
        // Handle your plugin enable methods here
        // This is also where your able to use BurchAPI instances from the BurchAPI class
    }

    @Override
    public void onPluginDisable() {
        // Handle your plugin shutdown methods here
    }

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

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

As you notice, there is onPluginEnable() and onPluginDisable(), we override the default onEnable() and onDisable() in our API that way we make sure you don't have to initialize anything yourself and bloat your class with unnecessary boiler code

You may notice 2 more methods that are being Overriden isDebug() and loggerPrefix():

If you choose not to Override isDebug(), the debug mode is false by default, this is used for Logger#debug() calls

If you choose not to Override loggerPrefix(), the default String is BurchAPI for the Logger prefix's

We understand many may not like this part, but we decide to do this to better prevent any complications on the user's end, we try to keep the API as simple as possible and not filled with boiler code

Clone this wiki locally