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
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull ItemStackGets the item who have been clicked.@NotNull ClickTypeGets the click type.@NotNull ItemStackGets the item who was in the player cursor.@Nullable InventoryGets the inventory.@NotNull PlayerGets the player who is trying to click on the inventory.intgetSlot()Gets the clicked slot number.booleanGets if theEventshould be cancelled or not.voidsetCancelled(boolean cancel) Marks theEventas cancelled or not.voidsetClickedItem(@NotNull ItemStack clickedItem) Changes the clicked item.voidsetCursorItem(@NotNull ItemStack cursorItem) Changes the cursor item.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
-
InventoryPreClickEvent
-
-
Method Details
-
getPlayer
Gets the player who is trying to click on the inventory.- Specified by:
getPlayerin interfacePlayerEvent- Returns:
- the player who clicked
-
getSlot
public int getSlot()Gets the clicked slot number.- Returns:
- the clicked slot number
-
getClickType
Gets the click type.- Returns:
- the click type
-
getClickedItem
Gets the item who have been clicked.- Returns:
- the clicked item
-
setClickedItem
Changes the clicked item.- Parameters:
clickedItem- the clicked item
-
getCursorItem
Gets the item who was in the player cursor.- Returns:
- the cursor item
-
setCursorItem
Changes the cursor item.- Parameters:
cursorItem- the cursor item
-
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.- Specified by:
getInventoryin interfaceInventoryEvent- Returns:
- the inventory, null if this is a player's inventory
-