Package org.bukkit.event.inventory
Class InventoryInteractEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.inventory.InventoryEvent
org.bukkit.event.inventory.InventoryInteractEvent
- All Implemented Interfaces:
Cancellable
- Direct Known Subclasses:
InventoryClickEvent,InventoryDragEvent,TradeSelectEvent
An abstract base class for events that describe an interaction between a
HumanEntity and the contents of 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 TypeMethodDescriptionGets theEvent.Resultof this event.Gets the player who performed the click.booleanGets whether this event is cancelled.voidsetCancelled(boolean cancel) Proxy method tosetResult(org.bukkit.event.Event.Result)for the Cancellable interface.voidsetResult(@NotNull Event.Result newResult) Sets the result of this event.Methods inherited from class org.bukkit.event.inventory.InventoryEvent
getHandlerList, getHandlers, getInventory, getView, getViewersMethods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
InventoryInteractEvent
-
-
Method Details
-
getWhoClicked
Gets the player who performed the click.- Returns:
- The clicking player.
-
setResult
Sets the result of this event. This will change whether this event is considered cancelled.- Parameters:
newResult- the newEvent.Resultfor this event- See Also:
-
getResult
Gets theEvent.Resultof this event. The Result describes the behavior that will be applied to the inventory in relation to this event.- Returns:
- the Result of this event.
-
isCancelled
public boolean isCancelled()Gets whether this event is cancelled. This is based off of the Result value returned bygetResult().Event.Result.ALLOWandEvent.Result.DEFAULTwill result in a returned value of false, butEvent.Result.DENYwill result in a returned value oftrue.Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins
- Specified by:
isCancelledin interfaceCancellable- Returns:
- whether the event is cancelled
-
setCancelled
public void setCancelled(boolean cancel) Proxy method tosetResult(org.bukkit.event.Event.Result)for the Cancellable interface.setResult(org.bukkit.event.Event.Result)is preferred, as it allows you to specify the Result beyondEvent.Result.DENYandEvent.Result.ALLOW.Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.
- Specified by:
setCancelledin interfaceCancellable- Parameters:
cancel- result becomesEvent.Result.DENYiftrue,Event.Result.ALLOWiffalse
-