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
AbstractInventory.
Executed by Player.openInventory(Inventory).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the inventory to open, this could have been change by thesetInventory(AbstractInventory).Gets the player who opens the inventory.booleanGets if theEventshould be cancelled or not.voidsetCancelled(boolean cancel) Marks theEventas cancelled or not.voidsetInventory(AbstractInventory inventory) Changes the inventory to open.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface EntityInstanceEvent
getInstanceMethods inherited from interface PlayerEvent
getEntity
-
Constructor Details
-
InventoryOpenEvent
-
-
Method Details
-
getPlayer
Gets the player who opens the inventory.- Specified by:
getPlayerin interfacePlayerEvent- Returns:
- the player who opens the inventory
-
getInventory
Gets the inventory to open, this could have been change by thesetInventory(AbstractInventory).- Specified by:
getInventoryin 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:CancellableEventGets if theEventshould be cancelled or not.- Specified by:
isCancelledin interfaceCancellableEvent- Returns:
- true if the event should be cancelled
-
setCancelled
public void setCancelled(boolean cancel) Description copied from interface:CancellableEventMarks theEventas cancelled or not.- Specified by:
setCancelledin interfaceCancellableEvent- Parameters:
cancel- true if the event should be cancelled, false otherwise
-