- All Implemented Interfaces:
public class InventoryDragEvent extends InventoryInteractEvent
Canceling this event will result in none of the changes described in
getNewItems() being applied to the Inventory.
Because InventoryDragEvent occurs within a modification of the Inventory, not all Inventory related methods are safe to use.
The following should never be invoked by an EventHandler for InventoryDragEvent using the HumanEntity or InventoryView associated with this event.
BukkitScheduler.runTask(Plugin, Runnable), which will run the task on the next tick. Also be aware that this is not an exhaustive list, and other methods could potentially create issues as well.
Assuming the EntityHuman associated with this event is an instance of a
Player, manipulating the MaxStackSize or contents of an Inventory will
require an Invocation of
Any modifications to slots that are modified by the results of this
InventoryDragEvent will be overwritten. To change these slots, this event
should be cancelled and the changes applied. Alternatively, scheduling a
BukkitScheduler.runTask(Plugin, Runnable), which would
execute the task on the next tick, would work as well.
Nested Class Summary
Modifier and Type Method Description
getCursor()Gets the result cursor after the drag is done.
getInventorySlots()Gets the slots to be changed in this drag.
getNewItems()Gets all items to be added to the inventory in this drag.
getOldCursor()Gets an ItemStack representing the cursor prior to any modifications as a result of this drag.
getRawSlots()Gets the raw slot ids to be changed in this drag.
getType()Gets the DragType that describes the behavior of ItemStacks placed after this InventoryDragEvent.
setCursor(ItemStack newCursor)Sets the result cursor after the drag is done.
Methods inherited from class org.bukkit.event.inventory.InventoryInteractEvent
getResult, getWhoClicked, isCancelled, setCancelled, setResult
Methods inherited from class org.bukkit.event.inventory.InventoryEvent
getInventory, getView, getViewers
Gets all items to be added to the inventory in this drag.
- map from raw slot id to new ItemStack
Gets the raw slot ids to be changed in this drag.
- list of raw slot ids, suitable for getView().getItem(int)
Gets the slots to be changed in this drag.
- list of converted slot ids, suitable for
Gets the result cursor after the drag is done. The returned value is mutable.
- the result cursor
Sets the result cursor after the drag is done.
Changing this item stack changes the cursor item. Note that changing the affected "dragged" slots does not change this ItemStack, nor does changing this ItemStack affect the "dragged" slots.
newCursor- the new cursor ItemStack
Gets an ItemStack representing the cursor prior to any modifications as a result of this drag.
- the original cursor
Gets the DragType that describes the behavior of ItemStacks placed after this InventoryDragEvent.
The ItemStacks and the raw slots that they're being applied to can be found using
- the DragType of this InventoryDragEvent