Package org.bukkit.event.inventory
Class InventoryOpenEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.inventory.InventoryEvent
org.bukkit.event.inventory.InventoryOpenEvent
- All Implemented Interfaces:
Cancellable
Called when a player opens an inventory
-
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull HandlerListfinal @NotNull HumanEntityReturns the player involved in this eventbooleanGets the cancellation state of this event.voidsetCancelled(boolean cancel) Sets the cancellation state of this event.Gets the title override set by another event ornullif not set.voidtitleOverride(@Nullable Component titleOverride) Sets the title override or clears the override.Methods inherited from class org.bukkit.event.inventory.InventoryEvent
getInventory, getView, getViewersMethods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
InventoryOpenEvent
-
-
Method Details
-
getPlayer
Returns the player involved in this event- Returns:
- Player who is involved in this event
-
titleOverride
Gets the title override set by another event ornullif not set.- Returns:
- the title override or
null
-
titleOverride
Sets the title override or clears the override.This is only the title sent to the client in the open packet, this doesn't change the title returned by
InventoryView.title(), hence "override".NOTE: Horse inventories are a special case where setting this will have no effect. Horse inventory titles are set by the horse display name.
- Parameters:
titleOverride- the title override ornull
-
isCancelled
public boolean isCancelled()Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other pluginsIf this event is cancelled, the inventory screen will not show.
- Specified by:
isCancelledin interfaceCancellable- Returns:
trueif this event is cancelled
-
setCancelled
public void setCancelled(boolean cancel) Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.If this event is cancelled, the inventory screen will not show.
- Specified by:
setCancelledin interfaceCancellable- Parameters:
cancel-trueif you wish to cancel this event
-
getHandlers
- Overrides:
getHandlersin classInventoryEvent
-
getHandlerList
-