Api
The HuskTowns API provides methods for interfacing and editing towns, claims and users, alongside a selection of API events for listening to when players perform certain town actions.
Compatibility
The HuskTowns API shares version numbering with the plugin itself for consistency and convenience. Please note minor and patch plugin releases may make API additions and deprecations, but will not introduce breaking changes without notice.
API Version | HuskTowns Versions | Supported |
---|---|---|
v2.x | v2.0—Current | ✅ |
v1.x | v1.0—Current | ⚠️ |
Warning:The HuskTowns API v1 is deprecated. Click here for API v1 Docs…
Targeting older versions
HuskTowns versions prior to v2.3.1
are distributed on JitPack, and you will need to use the https://jitpack.io
repository instead.
Table of contents
- Adding the API to your project
- Adding HuskTowns as a dependency
- Next steps
API Introduction
1.1 Setup with Maven
Maven setup information
Add the repository to your pom.xml
as per below. You can alternatively specify /snapshots
for the repository containing the latest development builds (not recommended).
<repositories>
<repository>
<id>william278.net</id>
<url>https://repo.william278.net/releases</url>
</repository>
</repositories>
Add the dependency to your pom.xml
as per below. Replace VERSION
with the latest version of HuskTowns (without the v):
<dependency>
<groupId>net.william278</groupId>
<artifactId>husktowns</artifactId>
<version>VERSION</version>
<scope>provided</scope>
</dependency>
1.2 Setup with Gradle
Gradle setup information
Add the dependency as per below to your build.gradle
. You can alternatively specify /snapshots
for the repository containing the latest development builds (not recommended).
allprojects {
repositories {
maven { url 'https://repo.william278.net/releases' }
}
}
Add the dependency as per below. Replace VERSION
with the latest version of HuskTowns (without the v):
dependencies {
compileOnly 'net.william278:husktowns:VERSION'
}
2. Adding HuskTowns as a dependency
Add HuskTowns to your softdepend
(if you want to optionally use HuskTowns) or depend
(if your plugin relies on HuskTowns) section in plugin.yml
of your project.
name: MyPlugin
version: 1.0
main: net.william278.myplugin.MyPlugin
author: William278
description: 'A plugin that hooks with the HuskTowns API!'
softdepend: # Or, use 'depend' here
- HuskTowns
3. Next steps
Now that you've got everything ready, you can start doing stuff with the HuskTowns API!