Package org.bukkit.event.inventory
Class InventoryCloseEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.inventory.InventoryEvent
org.bukkit.event.inventory.InventoryCloseEvent
This event is called when a player closes an inventory.
Because InventoryCloseEvent occurs within a modification of the Inventory, not all Inventory related methods are safe to use.
Methods that change the view a player is looking at should never be invoked by an EventHandler for InventoryCloseEvent using the HumanEntity or InventoryView associated with this event. Examples of these include:
HumanEntity.closeInventory()
HumanEntity.openInventory(org.bukkit.inventory.Inventory)
HumanEntity.openWorkbench(org.bukkit.Location, boolean)
HumanEntity.openEnchanting(org.bukkit.Location, boolean)
InventoryView.close()
BukkitScheduler.runTask(org.bukkit.plugin.Plugin, Runnable)
, which will run the task
on the next tick. Also be aware that this is not an exhaustive list, and
other methods could potentially create issues as well.-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
Field Summary
Fields inherited from class org.bukkit.event.inventory.InventoryEvent
transaction
-
Constructor Summary
ConstructorDescriptionInventoryCloseEvent
(@NotNull InventoryView transaction) InventoryCloseEvent
(@NotNull InventoryView transaction, @NotNull InventoryCloseEvent.Reason reason) -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull HandlerList
final @NotNull HumanEntity
Returns the player involved in this eventMethods inherited from class org.bukkit.event.inventory.InventoryEvent
getInventory, getView, getViewers
Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
InventoryCloseEvent
-
InventoryCloseEvent
public InventoryCloseEvent(@NotNull @NotNull InventoryView transaction, @NotNull @NotNull InventoryCloseEvent.Reason reason)
-
-
Method Details
-
getReason
-
getPlayer
Returns the player involved in this event- Returns:
- Player who is involved in this event
-
getHandlers
- Overrides:
getHandlers
in classInventoryEvent
-
getHandlerList
-