Skip to content

Initialization

Asintoto edited this page Jul 15, 2024 · 4 revisions

Basic Initialization process

You must follow the following steps in order to properly use Basic inside your plugin


Primary Method (Reccomended)

Initialize the plugin

NOTE: Change "extends JavaPlugin" with "extends BasicPlugin"

public final class YourPlugin extends BasicPlugin{
    @Override
    public void onPluginLoad() {

        // all Basic's Options (see in the "Options" page)

        // Your plugin loading logic
    }

    @Override
    public void onPluginEnable() {
        // Your plugin start up logic
    }

    @Override
    public void onPluginDisable() {
        // Your plugin disabling logic
    }
}

By using this Initialization method, Basic.init() and Basic.terminate() are automatically executed.

Alternative Method (NOT Reccomended)

Initialize the componets

public final class YourPlugin extends JavaPlugin {

    @Override
    public void onEnable() {

        // all Basic's Options (see in the "Options" page)

        Basic.init(this);

        // Your plugin start up logic

    }

    @Override
    public void onDisable() {

        Basic.terminate();

        // Your plugin disabling logic
    }
}

You must insert Basic.init(this) in order to let Basic hook with your plugin and inject into it all the required structures and methods. Then, use Basic.terminate() to safely stop Basic.

Note: You must specify all Basic's Options before initializing it! More info here