Skip to content

Events (Bukkit API)

Hamza Coşkun edited this page Jan 25, 2024 · 5 revisions

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

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

Cancellable: True

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

Cancellable: True

Trigger: When any gui opened.

Cancellable: True

Trigger: When any GUI is closed.

Cancellable: False

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