Skip to content

3. Create your main class

RedsTom edited this page May 15, 2021 · 1 revision

Create the main class of your project.

To load a plugin, your jar file must contain a class annotated with the @BotPlugin annotation.

@BotPlugin(
  id = "MyAddonId",
  name = "My Addon",
  author = "Me"
)
public class Main {

}

But this is not enough. The main class must have two methods :

load() : Called when the plugin is loaded, when the server starts. and unload() : Called when the plugin is unloaded, when the server stops. | ⚠️ Never called now.

Your main class will finally look like this :

@BotPlugin(
  id = "MyAddonId",
  name = "My Addon",
  author = "Me"
)
public class Main {
    public void load() {
        System.out.println("My Addon loaded !");
    }

    public void unload() {
        System.out.println("My Addon unloaded !");
    }
}
Clone this wiki locally