Events (Bukkit API) - hamza-cskn/obliviate-invs GitHub Wiki

ObliviateInvs also triggers Bukkit Events. Here is why you may want to use these events:

  • To handle all GUIs.
  • To make your codes independent.
  • To use events that have maximum priority.
  • To cancel some normally uncancellable operations.

List of events

GuiPreClickEvent

Trigger: When any player clicks on any slot of any GUI.

Cancellable: True

GuiPreDragEvent

Trigger: When any player drags any item at any slot of any GUI.

Cancellable: True

GuiPreOpenEvent

Trigger: When any gui opened.

Cancellable: True

GuiPreCloseEvent

Trigger: When any GUI is closed.

Cancellable: False

FakeInventoryCloseEvent

Trigger: When an inventory is opened and overridden by another inventory, the event will be triggered for the old one.

Cancellable: False

Overrided inventories do not trigger inventory close events in old versions. This bug creates issues in some mechanisms (scheduler problems). The obliviate-invs automatically fixes that bug. In modern versions, the natural inventory close event works properly.

Usage

@EventHandler
public void onClick(final GuiPreClickEvent event) {
    event.setCancelled(false); // before deploying that code to your plugin, ensure you hate your life.
}