Developers - Rumsfield/konquest GitHub Wiki
To include the Konquest API in your project, add the following code. The latest versions can be found on the releases page and use tag names with the format v#.#.#
. The API is published to the JitPack repository.
Add these lines to the dependencies
section of your POM:
<dependencies>
<dependency>
<groupId>com.github.Rumsfield</groupId>
<artifactId>konquest</artifactId>
<version>v1.6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
Add these lines to your Gradle build script:
Groovy DSL
repositories {
maven("https://jitpack.io")
}
dependencies {
compileOnly'com.github.Rumsfield:konquest:v1.6.0'
}
Kotlin DSL
repositories {
mavenCentral()
maven {
name = "jitpack"
url = "https://jitpack.io"
}
}
dependencies {
compileOnly "com.github.Rumsfield:konquest:v1.6.0"
}
Refer to the Javadoc for API details.
See this example plugin for how to use the API: https://github.com/Rumsfield/KonquestAddonExample
In your plugin, get an instance of the KonquestAPI class to access the rest of the API methods. For example:
KonquestAPI api = null;
Plugin konquest = Bukkit.getPluginManager().getPlugin("Konquest");
if (konquest != null && konquest.isEnabled()) {
RegisteredServiceProvider<KonquestAPI> provider = Bukkit.getServicesManager().getRegistration(KonquestAPI.class);
if (provider != null) {
api = provider.getProvider();
Bukkit.getServer().getConsoleSender().sendMessage("Successfully enabled Konquest API");
} else {
Bukkit.getServer().getConsoleSender().sendMessage("Failed to enable Konquest API, invalid provider");
}
} else {
Bukkit.getServer().getConsoleSender().sendMessage("Failed to enable Konquest API, plugin not found or disabled");
}
Once you have the KonquestAPI object, get some manager classes from it and do cool stuff. You can also listen for events from the Konquest events packages just like normal Bukkit events.