Setup
Adding Kapi as a dependency
- Gradle (Kotlin)
- Gradle (Groovy)
- Maven
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")
}
Add the dependency to your build.gradle
file.
plugins {
id "io.github.goooler.shadow" version "8.1.8"
}
repositories {
mavenCentral()
}
dependencies {
implementation "io.github.kapimc:kapi:[VERSION]"
}
// TODO: missing shadowJar, if you use groovy with gradle
// consider contributing a code snippet to add this
Add the following snippets in your pom.xml
file.
Inside the <dependencies>
tag.
<dependency>
<groupId>io.github.kapimc</groupId>
<artifactId>kapi</artifactId>
<version>[VERSION]</version>
</dependency>
Inside the <plugins>
tag.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<relocations>
<relocation>
<pattern>io.github.kapimc.kapi</pattern>
<shadedPattern>[YOUR PACKAGE].kapi</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
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 toonEnable()
).onPluginUnload()
- exit point of the plugin (similar toonDisable()
).
Example
public class MyPlugin extends KapiPlugin {
@Override
public void onPluginLoad() {
// Plugin Enabled
}
@Override
public void onPluginUnload() {
// Plugin Disabled
}
}