Skip to content
Shane Bee edited this page May 3, 2026 · 7 revisions

Setting up SKR in your new addon is relatively fairly simple.

1) Shading:

You will need to shade SKR into your plugin, here is a simple example in a build.gradle.kts file.

plugins {
    id("java")
    id("com.gradleup.shadow") version "9.4.1"
}

repositories {
    // JitPack
    maven("https://jitpack.io") {
        metadataSources {
            mavenPom()
            artifact()
            // This ignores the .module file and forces Gradle to use the POM/JAR
        }
    }
}

dependencies {
    // SkriptRegistration (check for latest release version in the releases tab)
    implementation("com.github.ShaneBeee:SkriptRegistration:1.1.0")
}

tasks {
    shadowJar {
        relocate("com.github.shanebeee.skr", "my.addon.something.skr")
    }
    jar {
        dependsOn(shadowJar)
    }
}

2) Setup Addon/Registration:

Now that things are shaded and ready to go, we can setup our new addon.

public class MyAddon extends JavaPlugin {

    Registration registration;

    @Override
    public void onEnable() {

        // Only load addon if Skript is present
        if (Bukkit.getPluginManager().getPlugin("Skript") != null) {

            // Verify Skript is accepting new addons
            if (Skript.isAcceptRegistrations()) {
                // Create a new instance of Registration (SKR)
                this.registration = new Registration("MyAddon", true);

                // Register your elements in another class (we'll visit this below)
                ElementRegistration.register(this.registration);
            } else {
                // Send an error message
                return;
            }
        } else {
            // Send an error message
            return;
        }

        // We'll revisit this later
        registerCommand("my-addon", (source, args) -> {
            if (args.length == 1 && args[0].equalsIgnoreCase("docs")) {
                JsonDocGenerator gen = new JsonDocGenerator(MyAddon.this, MyAddon.this.registration);
                gen.generateDocs();
            }
        });
    }

}

3) Register Elements:

After we get our new addon setup, we can start registering some elements.
I personally prefer to do this in another class (or multiple classes) to keep things organized and tidy.

public class ElementRegistration {

    public static void register(Registration reg) {
        // EFFECTS
        EffSomeEffect.register(reg);

        // EVENTS
        MyEvents.register(reg); // A class with multiple events
        EvtSomeEvent.register(reg); // A class with a single event

        // EXPRESSIONS
        ExprSomeExpression.register(reg);

        // SECTIONS
        SecSomeSection.register(reg);

        // STRUCTURES
        StructSomeStructure.register(reg);

        // TYPES
        Types.register(reg);

        // FINALIZE
        // After all elements are registered, 
        // we finalize by passing our elements into Skript's official registration 
        reg.finalizeRegistration();
    }

}

Clone this wiki locally