Class InventoryOpenEvent
java.lang.Object
net.minestom.server.event.inventory.InventoryOpenEvent
- All Implemented Interfaces:
Event
,CancellableEvent
,EntityEvent
,EntityInstanceEvent
,InstanceEvent
,InventoryEvent
,PlayerEvent
,PlayerInstanceEvent
public class InventoryOpenEvent
extends Object
implements InventoryEvent, PlayerInstanceEvent, CancellableEvent
Called when a player open an
Inventory
.
Executed by Player.openInventory(Inventory)
.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@Nullable Inventory
Gets the inventory to open, this could have been change by thesetInventory(Inventory)
.@NotNull Player
Gets the player who opens the inventory.boolean
Gets if theEvent
should be cancelled or not.void
setCancelled
(boolean cancel) Marks theEvent
as cancelled or not.void
setInventory
(@Nullable Inventory inventory) Changes the inventory to open.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minestom.server.event.trait.EntityInstanceEvent
getInstance
Methods inherited from interface net.minestom.server.event.trait.PlayerEvent
getEntity
-
Constructor Details
-
InventoryOpenEvent
-
-
Method Details
-
getPlayer
Gets the player who opens the inventory.- Specified by:
getPlayer
in interfacePlayerEvent
- Returns:
- the player who opens the inventory
-
getInventory
Gets the inventory to open, this could have been change by thesetInventory(Inventory)
.- Specified by:
getInventory
in interfaceInventoryEvent
- Returns:
- the inventory to open, null to just close the current inventory if any
-
setInventory
Changes the inventory to open.To do not open any inventory see
setCancelled(boolean)
.- Parameters:
inventory
- the inventory to open
-
isCancelled
public boolean isCancelled()Description copied from interface:CancellableEvent
Gets if theEvent
should be cancelled or not.- Specified by:
isCancelled
in interfaceCancellableEvent
- Returns:
- true if the event should be cancelled
-
setCancelled
public void setCancelled(boolean cancel) Description copied from interface:CancellableEvent
Marks theEvent
as cancelled or not.- Specified by:
setCancelled
in interfaceCancellableEvent
- Parameters:
cancel
- true if the event should be cancelled, false otherwise
-