Using the API
The API is packaged as a JAR file and will be required to be on your classpath in order for your plugins to reference it within RuneLite. You generally have two options for this:
- Include the API in your build process and bundle the API as a "fat jar" in with your plugin classes
- Hijack the RuneLite bootstrap process as part of a launcher to pull in the API dependency when RuneLite starts
This document isn't intended to cover integrating the API into your plugin build and release process. The API will come packaged as a standard JAR file. How you choose to integrate and provide the API to your plugins is up to you and your build process. Take note of the warning regarding ByteBuddy below.
⚠️ Note: The fat jar does NOT include the
net.bytebuddy.byte-buddydependency as it doubles the size of the output jar and space is limited on GitHub packages. Your plugin side-loading process MUST provide the bytebuddy dependency at runtime for functionality in thecom.kraken.api.core.interceptorpackage to work. i.e. Patching the Mouse Hook DLL & Packet interception logic
Gradle Example
To use the API jar file in your plugin project you will need to either:
export GITHUB_ACTOR=<YOUR_GITHUB_USERNAME>; export GITHUB_TOKEN=<GITHUB_PAT- or add the following to your
gradle.propertiesfile:gpr.user=your-github-username gpr.key=your-personal-access-token
More information on generating a GitHub Personal Access token can be found below.
Authentication
Since the API packages are hosted on GitHub Packages you will need to generate a Personal Access Token (PAT) on GitHub to authenticate and pull down the API.
You can generate a GitHub PAT by navigating to your GitHub Settings and clicking "Generate new Token." Give the token a unique name and optional description with read-only access to public repositories. Store the token in a safe place as it won't be viewable again. It can be used to authenticate to GitHub and pull Kraken API packages.
⚠️ Do NOT share this token with anyone.
plugins {
id 'java'
id 'application'
}
// Replace with the package version of the API you need
def krakenApiVersion = 'X.Y.Z'
allprojects {
apply plugin: 'java'
repositories {
// You must declare this maven repository to be able to search and pull Kraken API packages
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/Kraken-Plugins/kraken-api")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
}
}
// Jitpack is an alternative means of accessing the API Jar file
maven { url 'https://jitpack.io' }
}
}
dependencies {
compileOnly group: 'com.github.kraken', name:'kraken-api', version: krakenApiVersion
// ... other dependencies
}⚠️ Note: The fat jar does NOT include the
net.bytebuddy.byte-buddydependency as it doubles the size of the output jar and space is limited on GitHub packages. Your plugin side-loading process MUST provide the bytebuddy dependency at runtime for functionality in thecom.kraken.api.core.interceptorpackage to work. i.e. Patching the Mouse Hook DLL & Packet interception logic
Maven Build Example
Here is an example of a Maven pom.xml using the Kraken API.
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0
https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>kraken-client</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<!-- Replace with the package version of the API you need -->
<kraken.api.version>X.Y.Z</kraken.api.version>
</properties>
<repositories>
<repository>
<id>github</id>
<name>GitHubPackages</name>
<url>https://maven.pkg.github.com/Kraken-Plugins/kraken-api</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.kraken</groupId>
<artifactId>kraken-api</artifactId>
<version>${kraken.api.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<!-- Rest of your build goes here -->
<!-- Configure GitHub Packages authentication -->
<distributionManagement>
<repository>
<id>github</id>
<name>GitHubPackages</name>
<url>https://maven.pkg.github.com/Kraken-Plugins/kraken-api</url>
</repository>
</distributionManagement>
</project>Since Maven doesn't support inline credentials like Gradle does, you will need to edit your ~/.m2/settings.xml file with the following:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<!-- GitHub Packages authentication -->
<server>
<id>github</id>
<username>${env.GITHUB_ACTOR}</username>
<password>${env.GITHUB_TOKEN}</password>
</server>
</servers>
<profiles>
<profile>
<id>github</id>
<repositories>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/Kraken-Plugins/kraken-api</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>github</activeProfile>
</activeProfiles>
</settings>API Versioning
Each release of the API will publish a new semantic version. You can check the latest versions of the API here.