Package net.minestom.server.inventory
Interface InventoryClickHandler
- All Known Implementing Classes:
AbstractInventory,AnvilInventory,BeaconInventory,BrewingStandInventory,EnchantmentTableInventory,FurnaceInventory,Inventory,PlayerInventory,VillagerInventory
Represents an inventory which can receive click input.
All methods returning boolean returns true if the action is successful, false otherwise.
See https://wiki.vg/Protocol#Click_Window for more information.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidcallClickEvent(@NotNull Player player, Inventory inventory, int slot, @NotNull ClickType clickType, @NotNull ItemStack clicked, @NotNull ItemStack cursor) booleanchangeHeld(@NotNull Player player, int slot, int key) Called when aPlayerheld click in the inventorybooleandoubleClick(@NotNull Player player, int slot) Called when aPlayerdouble click in the inventorybooleanbooleanCalled when aPlayerpress the drop buttonbooleanCalled when aPlayerleft click in the inventory.booleanmiddleClick(@NotNull Player player, int slot) booleanrightClick(@NotNull Player player, int slot) Called when aPlayerright click in the inventory.booleanshiftClick(@NotNull Player player, int slot, int button) Called when aPlayershift click in the inventory
-
Method Details
-
leftClick
Called when aPlayerleft click in the inventory. Can also be to drop the cursor item- Parameters:
player- the player who clickedslot- the slot number- Returns:
- true if the click hasn't been cancelled, false otherwise
-
rightClick
Called when aPlayerright click in the inventory. Can also be to drop the cursor item- Parameters:
player- the player who clickedslot- the slot number- Returns:
- true if the click hasn't been cancelled, false otherwise
-
shiftClick
Called when aPlayershift click in the inventory- Parameters:
player- the player who clickedslot- the slot numberbutton- the primary mouse or secondary mouse button- Returns:
- true if the click hasn't been cancelled, false otherwise
-
changeHeld
Called when aPlayerheld click in the inventory- Parameters:
player- the player who clickedslot- the slot numberkey- the held slot (0-8) pressed- Returns:
- true if the click hasn't been cancelled, false otherwise
-
middleClick
-
drop
Called when aPlayerpress the drop button- Parameters:
player- the player who clickedall-slot- the slot numberbutton- -999 if clicking outside, normal if he is not- Returns:
- true if the drop hasn't been cancelled, false otherwise
-
dragging
-
doubleClick
Called when aPlayerdouble click in the inventory- Parameters:
player- the player who clickedslot- the slot number- Returns:
- true if the click hasn't been cancelled, false otherwise
-
callClickEvent
-