Registering your Addon

Now that we have our addon all setup and created from the Getting started section of Addon development.

We now have to enable our addon and tell Skript that we're trying to register a new addon and syntax.

So first we create a method called "onEnable" Spigot will automatically detect this method and run it when the server starts. Keep in mind that your "main" node in your plugin.yml must link to your class name of this class with the onEnable method.

package me.limeglass.addon;



import ch.njol.skript.Skript;
import ch.njol.skript.SkriptAddon;

public class ExampleMain extends JavaPlugin {

   ExampleMain instance;
   SkriptAddon addon;

   public void onEnable() {
       instance = this;
       addon = Skript.registerAddon(this);
       try {
           //This will register all our syntax for us. Explained below
           addon.loadClasses("me.limeglass.addon", "elements");
       } catch (IOException e) {
       Bukkit.getLogger().info("[ExampleAddon] has been enabled!");

   public ExampleMain getInstance() {
       return instance;

   public SkriptAddon getAddonInstance() {
       return addon;

Now to create a set of packages to help Skript register syntax.

In order to do this, we need to create a basic package. I'm calling it elements, this is also how RandomSk calls it's syntax package.

In Eclipse: Click the me.limeglass.addon package and click New -> Package

This is the main package where all our syntax are going to be stored. Keep in mind that what ever you name here, you should update the loadClasses() from the onEnable() method that we setup, to what ever you named it here.

Now our addon should look like this:

Now our addon is registered to Skript! We can now finally start making some Syntax!

Head over to the Creating an Expression section to continue the tutorial, or click the Next button below.

Addon tutorial
Back | Next