ALB Studio

Build a plugin

Set up Gradle, plugin.yml and onEnable for a plugin that runs on ALBCore.

Docs updated · What changed

On this page

Publish the API jarLink to this section

First publish the ALBCore API jar to your local Maven repository. Run this in the ALBCore source folder:

Terminal
./gradlew publishToMavenLocal

build.gradle.ktsLink to this section

build.gradle.kts
plugins { kotlin("jvm") version "2.4.21" }

repositories {
    mavenLocal()
    mavenCentral()
    maven("https://repo.papermc.io/repository/maven-public/")
}

dependencies {
    compileOnly("io.papermc.paper:paper-api:26.3.build.252-stable")
    compileOnly("com.aayan:alb-core:1.6.0")
    compileOnly(kotlin("stdlib"))   // ALBCore ships the Kotlin runtime
}

kotlin { jvmToolchain(25) }

And in gradle.properties:

gradle.properties
kotlin.stdlib.default.dependency=false

plugin.ymlLink to this section

plugin.yml
name: MyPlugin
version: '1.0.0'
main: com.example.myplugin.MyPlugin
api-version: '26.3'
depend: [ALBCore]

onEnableLink to this section

Kotlin
override fun onEnable() {
    // Check first: if ALBCore failed to start, its classes can no longer be loaded.
    if (!server.pluginManager.isPluginEnabled("ALBCore")) {
        server.pluginManager.disablePlugin(this)
        return
    }
    val core = ALBCore.instance
    core.database.migrate(name) { /* tables, see Migrations */ }
    CommandUtil.registerCommand(this, "level") { /* ... */ }
    PAPIHook.register(this, "myplugin", "total") { player -> totalOf(player).toString() }
}

NamingLink to this section

All plugins built on ALBCore share one database. Start every table name with the plugin's short name, so table("level_players") becomes alb_level_players, and use the plugin name as the migration owner. Publish placeholders under the plugin's own identifier, such as %myplugin_total%.

Type a class, method, config key or topic. Use the arrow keys and Enter to open a result.