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.
Note that the HuskTowns API v2 is different from the deprecated, legacy HuskTowns API v1.
The API is distributed via JitPack. (Some) javadocs are also available to view on JitPack here.
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.
<repositories> <repository> <id>jitpack.io</id> <url>https://jitpack.io</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 like so to your build.gradle
:
allprojects { repositories { maven { url 'https://jitpack.io' } }}
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: MyPluginversion: 1.0main: net.william278.myplugin.MyPluginauthor: William278description: '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!