Files
HuskHomes/docs/API-Events.md
T
William ffe995ef5f refactor: significantly refactor internals, remove Sponge (#708)
* feat: start database refactor

Adds database migrations

* refactor: refactor database system

Now supports migrations

* refactor: begin major internals rewrite

move to using provider-style interfaces similar to huskclaims
bukkit done, still need to do fabric and sponge

* refactor: remove sponge, checkstyle

Low usage and high maintenance time cost. We will examine Forge instead in the future.

* refactor: implement refactoring changes on fabric

also fix various refactor quirks on Bukkit

* refactor: tidy metrics logic

* build: bump deps
2024-10-28 20:49:57 +00:00

3.6 KiB

HuskHomes provides a number of API events your plugin can listen to when certain actions are performed. Most of these events are cancellable, letting you stop them from executing if you wish.

List of API events

Bukkit Event class Since Cancellable Description
HomeCreateEvent 4.0 ✅ Called when a player sets a home
HomeListEvent 3.0 ✅ Called when a player requests to view a list of homes / public homes
HomeEditEvent 4.0 ✅ Called when a player edits a home (privacy, relocate, description, name)
HomeDeleteEvent 3.0 ✅ Called when a player deletes a home†
DeleteAllHomesEvent 3.2.1 ✅ Called when a player uses /delhome all to delete all their homes
WarpCreateEvent 4.0 ✅ Called when a player sets a warp
WarpListEvent 3.0 ✅ Called when a player requests to view a list of warps
WarpEditEvent 4.0 ✅ Called when a player edits a warp (relocate, description, name)
WarpDeleteEvent 3.0 ✅ Called when a player deletes a warp†
DeleteAllWarpsEvent 3.2.1 ✅ Called when a player uses /delwarp all to delete all warps
SendTeleportRequestEvent 4.1 ✅ Called when a player sends a teleport request (/tpa)
ReceiveTeleportRequestEvent 4.1 ✅ Called when a player receives a teleport request from someone
ReplyTeleportRequestEvent 4.1 ✅ Called when a player accepts or declines a teleport request
TeleportWarmupEvent 3.0 ✅ Called when a player starts a teleport warmup countdown
TeleportWarmupCancelledEvent 4.6.3 ❌ Called when a player cancels the teleport warmup
TeleportEvent 3.0 ✅ Called when a player is teleported‡
TeleportBackEvent 4.1 ✅ Called when a player teleports to their last position (/back)‡

† If the player uses /delhome all or /delwarp all to delete all their homes or all the warps, a single DeleteAllHomesEvent or DeleteAllWarpsEvent is fired instead. ‡ Called on the server the player is teleported from; not necessarily where the executor of the teleport is.

Events on Fabric

Note: Check the API introduction for details on targeting platforms

Fabric uses callbacks for handling events. HuskHomes provides callback equivalents for all the above events. For instance, to handle what to do when someone creates a home, you can register a callback to handle what to do as follows:

HuskHomes and Fabric callbacks
HomeCreateCallback.EVENT.register((player, home) -> {
    // Do something with the player and home
    return ActionResult.SUCCESS; // Return an appropriate ActionResult
});.