Class InventoryPreClickEvent
java.lang.Object
net.minestom.server.event.inventory.InventoryPreClickEvent
- All Implemented Interfaces:
Event, CancellableEvent, EntityEvent, EntityInstanceEvent, InstanceEvent, InventoryEvent, PlayerEvent, PlayerInstanceEvent
public class InventoryPreClickEvent
extends Object
implements InventoryEvent, PlayerInstanceEvent, CancellableEvent
Called before
InventoryClickEvent, used to potentially cancel the click.-
Constructor Summary
ConstructorsConstructorDescriptionInventoryPreClickEvent(AbstractInventory inventory, Player player, Click click) -
Method Summary
Modifier and TypeMethodDescriptiongetClick()Gets the player's click.Returns the clicked item.Gets the inventory that was clicked.Gets the player who is trying to click on the inventory.intgetSlot()Returns the clicked slot.booleanGets if theEventshould be cancelled or not.voidsetCancelled(boolean cancel) Marks theEventas cancelled or not.voidSets the player's click.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
-
InventoryPreClickEvent
-
-
Method Details
-
getPlayer
Gets the player who is trying to click on the inventory.- Specified by:
getPlayerin interfacePlayerEvent- Returns:
- the player who clicked
-
getClick
Gets the player's click. -
setClick
Sets the player's click. -
getSlot
public int getSlot()Returns the clicked slot. This is only for convenience and may return -999 (a meaningless number), as some clicks don't have a relevant slot (drag clicks and some drops). SeeClick.slot()for details. -
getClickedItem
Returns the clicked item. Some clicks involve more than a single item, like drops or clicks outside the inventory menu; in these cases, the cursor is returned. -
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
-
getInventory
Description copied from interface:InventoryEventGets the inventory that was clicked.- Specified by:
getInventoryin interfaceInventoryEvent
-