Get Started
- 📚 Setup
- ➡️ Importers
- 📄 Config
- 📝 Translations
- 🔌 Hooks
Documentation
- 🖥️ Commands
- ⛔ Permissions
- 🥄 Claims
- ❤️ Trust
- 🎛️ Operation Groups
- 🪧 Sign Moderation
- 🪦 Drops Moderation
- 😴 Inactivity Pruning
- 🐕 Pets
The HuskClaims API provides methods for interfacing with and editing claims and users, alongside a selection of API events for listening to when players perform certain actions.
The HuskClaims 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 | HuskClaims Versions | Supported |
---|---|---|
v1.x | v1.0—Current | ✅ |
The HuskClaims API is available for the following platforms:
bukkit
- Bukkit, Spigot, Paper, etc. Provides Bukkit API event listeners and adapters to org.bukkit
objects.common
- Common API for all platforms.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 PLATFORM
with your target platform (see above) and VERSION
with the latest version of HuskClaims (without the v):
<dependency>
<groupId>net.william278.huskclaims</groupId>
<artifactId>huskclaims-PLATFORM</artifactId>
<version>VERSION</version>
<scope>provided</scope>
</dependency>
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 PLATFORM
with your target platform (see above) and VERSION
with the latest version of HuskClaims (without the v):
dependencies {
compileOnly 'net.william278.huskclaims:huskclaims-PLATFORM:VERSION'
}
Add HuskClaims to your softdepend
(if you want to optionally use HuskClaims) or depend
(if your plugin relies on HuskClaims) 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 HuskClaims API!'
softdepend: # Or, use 'depend' here
- HuskClaims
ClassNotFoundException
spublic class HuskClaimsAPIHook {
public HuskClaimsAPIHook() {
// Ready to do stuff with the API
}
}
public class MyPlugin extends JavaPlugin {
public HuskClaimsAPIHook huskClaimsAPIHook;
@Override
public void onEnable() {
if (Bukkit.getPluginManager().getPlugin("HuskClaims") != null) {
this.huskClaimsAPIHook = new HuskClaimsAPIHook();
}
}
}
HuskClaimsAPI#getInstance()
import net.william278.huskclaims.api.BukkitHuskClaimsAPI;
public class HuskClaimsAPIHook {
private final BukkitHuskClaimsAPI huskClaimsAPI;
public HuskClaimsAPIHook() {
this.huskClaimsAPI = BukkitHuskClaimsAPI.getInstance(); // Or, HuskClaimsAPI.getInstance() for the common API
}
}
CompletableFuture
s and Optional
s.CompletableFuture
is an asynchronous callback mechanism. The method will be processed asynchronously and the data returned when it has been retrieved. Then, use CompletableFuture#thenAccept(data -> {})
to do what you want to do with the data
you requested after it has asynchronously been retrieved, to prevent lag.Optional
is a null-safe representation of data, or no data. You can check if the Optional is empty via Optional#isEmpty()
(which will be returned by the API if no data could be found for the call you made). If the optional does contain data, you can get it via `Optional#get().Warning:You should never call#join()
on futures returned from the HuskClaims API as futures are processed on server asynchronous tasks, which could lead to thread deadlock and crash your server if you attempt to lock the main thread to process them.
Now that you've got everything ready, you can start doing stuff with the HuskClaims API!