Record Class GuiDragContext
java.lang.Object
java.lang.Record
com.github.darksoulq.abyssallib.server.event.context.gui.GuiDragContext
- Record Components:
source- The entity (player) who performed the drag.view- The Gui View currently open.newCursor- The item that will remain on the cursor after the drag completes.oldCursor- The item that was on the cursor before the drag started.type- The type of drag performed (e.g., SINGLE/Right-click drag or EVEN/Left-click drag).newItems- A map of raw slot IDs to the ItemStacks that will be placed in them.rawSlots- The set of raw slot IDs involved in the drag.inventorySlots- The set of converted slot IDs (relative to the specific inventory) involved.
public record GuiDragContext(org.bukkit.entity.HumanEntity source, GuiView view, @Nullable org.bukkit.inventory.ItemStack newCursor, @NotNull org.bukkit.inventory.ItemStack oldCursor, org.bukkit.event.inventory.DragType type, Map<Integer, org.bukkit.inventory.ItemStack> newItems, Set<Integer> rawSlots, Set<Integer> inventorySlots)
extends Record
A context object representing the details of an inventory drag interaction.
This class encapsulates all relevant data when a player drags an item across inventory slots, including the items being distributed, the slots affected, and the type of drag operation.
-
Constructor Summary
ConstructorsConstructorDescriptionGuiDragContext(org.bukkit.entity.HumanEntity source, GuiView view, @Nullable org.bukkit.inventory.ItemStack newCursor, @NotNull org.bukkit.inventory.ItemStack oldCursor, org.bukkit.event.inventory.DragType type, Map<Integer, org.bukkit.inventory.ItemStack> newItems, Set<Integer> rawSlots, Set<Integer> inventorySlots) Creates an instance of aGuiDragContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Gets the converted inventory slot IDs to be changed.@Nullable org.bukkit.inventory.ItemStackGets the result cursor after the drag is done.newItems()Gets all items to be added to the inventory in this drag.@NotNull org.bukkit.inventory.ItemStackGets the cursor item prior to the drag modification.rawSlots()Gets the raw slot IDs to be changed in this drag.org.bukkit.entity.HumanEntitysource()Gets the entity that performed the drag.final StringtoString()Returns a string representation of this record class.org.bukkit.event.inventory.DragTypetype()Gets the DragType describing the distribution behavior.view()Gets the view of the gui that is open.
-
Constructor Details
-
GuiDragContext
public GuiDragContext(org.bukkit.entity.HumanEntity source, GuiView view, @Nullable @Nullable org.bukkit.inventory.ItemStack newCursor, @NotNull @NotNull org.bukkit.inventory.ItemStack oldCursor, org.bukkit.event.inventory.DragType type, Map<Integer, org.bukkit.inventory.ItemStack> newItems, Set<Integer> rawSlots, Set<Integer> inventorySlots) Creates an instance of aGuiDragContextrecord class.- Parameters:
source- the value for thesourcerecord componentview- the value for theviewrecord componentnewCursor- the value for thenewCursorrecord componentoldCursor- the value for theoldCursorrecord componenttype- the value for thetyperecord componentnewItems- the value for thenewItemsrecord componentrawSlots- the value for therawSlotsrecord componentinventorySlots- the value for theinventorySlotsrecord component
-
-
Method Details
-
source
public org.bukkit.entity.HumanEntity source()Gets the entity that performed the drag.- Returns:
- The
HumanEntitysource.
-
view
-
newCursor
@Nullable public @Nullable org.bukkit.inventory.ItemStack newCursor()Gets the result cursor after the drag is done.- Returns:
- The new cursor
ItemStack, ornullif empty.
-
oldCursor
@NotNull public @NotNull org.bukkit.inventory.ItemStack oldCursor()Gets the cursor item prior to the drag modification.- Returns:
- The original cursor
ItemStack.
-
type
public org.bukkit.event.inventory.DragType type()Gets the DragType describing the distribution behavior.- Returns:
- The
DragType.
-
newItems
-
rawSlots
-
inventorySlots
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object).
-