Honeypot Help

Events

Events

Honeypot publishes nine separate events for plugins to listen to. Each event (except one) is has two types: the regular variant, and a "Pre" variant.

The regular variant is called after the corresponding trigger is processed, while the "Pre" version is called before the corresponding trigger is processed. Consequently, only the "Pre" variant is cancellable.

Event Name

Description

Cancellable

HoneypotPreCreateEvent

Called when a Honeypot is about to be created, regardless of if the creation would be successful. If cancelled the Honeypot creation is also cancelled.

Yes

HoneypotCreateEvent

Called after, and only after, a Honeypot is successfully created

No

HoneypotPrePlayerBreakEvent

Called before Honeypot processes an action from a Honeypot block the player broke. If cancelled, the Honeypot block will break just like any other Minecraft block without consequences.

Yes

HoneypotPlayerBreakEvent

Called after Honeypot finishes processing an action from a Honeypot block triggered by a player breaking it

No

HoneypotNonPlayerBreakEvent

A unique event which does not have a "Pre" variant, this event is called when a non-player entity or block takes attempts to modify a Honeypot (pistons, fire, TNT, creepers, etc.). A player may have caused this event to trigger, but the actual object doing the modification was not the player (Such as TNT ignited by the player. The TNT did the actual modification, but the player caused it)

No

HoneypotPreInteractEvent

Called before Honeypot processes an action from a Honeypot container the player interacted with. The player may have permission to bypass the event, so this event doesn't necessarily indicate a successful Honeypot trigger. If cancelled, Honeypot will cease further processing of the event, allowing the player to interact as normal without consequences.

Yes

HoneypotInteractEvent

Called after Honeypot finishes processing an interact event. This event is always called at the end of processing, whether action was taken or not (Such as if the player had bypass permission).

No

HoneypotPreInventoryClickEvent

Called before Honeypot processes an action from a Honeypot container in which the player clicked inside its inventory. If cancelled, Honeypot will stop processing the event and the event will be allowed as normal.

Yes

HoneypotInventoryClickEvent

Called after Honeypot finishes processing an inventory click event. Unlike HoneypotInteractEvent, this event is only called upon successful processing of an inventory click action. This may change in the future to standardize behavior across events.

No

Listening to Events

All Honeypot events are registered in the org.reprogle.honeypot.api.events package. Here is the simplest example of listening to events from Honeypot

package me.terrorbyte.test; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.plugin.java.JavaPlugin; import [[[org.reprogle.honeypot.api.events.HoneypotPrePlayerBreakEvent|https://javadoc.jitpack.io/com/github/TerrorByteTW/Honeypot/honeypot-api/3.4.0/javadoc/org/reprogle/honeypot/api/events/HoneypotPrePlayerBreakEvent.html]]]; public class Test extends JavaPlugin implements Listener { public Test plugin; @Override public void onEnable(){ plugin = this; this.getLogger().info("Enabling!"); this.getServer().getPluginManager().registerEvents(this, this); } @Override public void onDisable(){ this.getLogger().info("Disabling!"); } @EventHandler public static void onHoneypotPrePlayerBreakEvent([[[HoneypotPrePlayerBreakEvent|https://javadoc.jitpack.io/com/github/TerrorByteTW/Honeypot/honeypot-api/3.4.0/javadoc/org/reprogle/honeypot/api/events/HoneypotPrePlayerBreakEvent.html]]] event) { event.getPlayer().sendMessage("You threw the event!"); } }
Last modified: 02 November 2024