Skip to content

Callbacks lifecycle

Misat11 edited this page May 11, 2020 · 2 revisions

Callbacks lifecycle (Groovy only)

There are many types of callbacks. Some of them is just for the inventory, some of them can be bound to specific item. Is it running when some events is called or created or when?

Well,

  1. the plugin create an event, e.g. ShopTransactionEvent
  2. if this event has specified item, it'll run the callbacks for this item (if there are any)
  3. then it'll call all inventory-bound callbacks (if there are any)
  4. the event will be fired to bukkit

Why?

  • Most of callbacks are cancellable so you can cancel it for specific item and if there are an isCancelled() checks than you can prevent other plugins handle it
  • You can override the settings for item before main callback or plugin listener is called
Clone this wiki locally