Skip to content

Events (Bukkit API)

Hamza Coşkun edited this page Sep 1, 2023 · 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 has maximum priority.
  • To cancel some uncancellable operations.

List of events

Trigger: When any player clicked to any slot of any gui.

Cancellable: True

Trigger: When any player dragged any item at any slot of any gui.

Cancellable: True

Trigger: When any gui opened.

Cancellable: True

Trigger: When any gui 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 does not triggers inventory close event 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 deploy that code to your plugin, ensure you hate your life.
}
Clone this wiki locally