Api Events

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 classSinceCancellableDescription
HomeCreateEvent4.0Called when a player sets a home
HomeListEvent3.0Called when a player requests to view a list of homes / public homes
HomeEditEvent4.0Called when a player edits a home (privacy, relocate, description, name)
HomeDeleteEvent3.0Called when a player deletes a home†
DeleteAllHomesEvent3.2.1Called when a player uses /delhome all to delete all their homes
WarpCreateEvent4.0Called when a player sets a warp
WarpListEvent3.0Called when a player requests to view a list of warps
WarpEditEvent4.0Called when a player edits a warp (relocate, description, name)
WarpDeleteEvent3.0Called when a player deletes a warp†
DeleteAllWarpsEvent3.2.1Called when a player uses /delwarp all to delete all warps
SendTeleportRequestEvent4.1Called when a player sends a teleport request (/tpa)
ReceiveTeleportRequestEvent4.1Called when a player receives a teleport request from someone
ReplyTeleportRequestEvent4.1Called when a player accepts or declines a teleport request
TeleportWarmupEvent3.0Called when a player starts a teleport warmup countdown
TeleportEvent3.0Called when a player is teleported‡
TeleportBackEvent4.1Called 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 Sponge & Fabric

Note:
Check the API introduction for details on targeting platforms

Sponge, which has a similar Event api as Bukkit, has equivalent events for all of the above, prefixed with Sponge (so HomeCreateEvent on Bukkit is SpongeHomeCreateEvent on Sponge).

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
});.