Skip to main content

Setup

Adding Kapi as a dependency

Add the dependency to your build.gradle.kts file.

plugins {
id("io.github.goooler.shadow") version "8.1.8"
}

repositories {
mavenCentral()
}

dependencies {
implementation("io.github.kapimc:kapi:[VERSION]")
}

tasks.shadowJar {
relocate("io.github.kapimc.kapi", "[YOUR PACKAGE].kapi")
}

Replace [VERSION] with the Kapi version you want to use, see versions for a list.
Replace [YOUR PACKAGE] with your own package, such as me.kyren223.myplugin

Main Class

Replace JavaPlugin with KapiPlugin.

Make sure to implement the needed methods

  • onPluginLoad() - entry point of the plugin (similar to onEnable()).
  • onPluginUnload() - exit point of the plugin (similar to onDisable()).

Example

public class MyPlugin extends KapiPlugin {

@Override
public void onPluginLoad() {
// Plugin Enabled
}

@Override
public void onPluginUnload() {
// Plugin Disabled
}
}