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
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable InventoryGets the inventory to open, this could have been change by thesetInventory(Inventory).@NotNull PlayerGets the player who opens the inventory.booleanGets if theEventshould be cancelled or not.voidsetCancelled(boolean cancel) Marks theEventas cancelled or not.voidsetInventory(@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, waitMethods inherited from interface net.minestom.server.event.trait.EntityInstanceEvent
getInstanceMethods 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:
getPlayerin interfacePlayerEvent- Returns:
- the player who opens the inventory
-
getInventory
Gets the inventory to open, this could have been change by thesetInventory(Inventory).- 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
-