Package com.ranull.graves.listener
Class InventoryDragListener
java.lang.Object
com.ranull.graves.listener.InventoryDragListener
- All Implemented Interfaces:
org.bukkit.event.Listener
Listener for handling InventoryDragEvent to manage grave-related inventory interactions.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInventoryDragListener(Graves plugin) Constructs an InventoryDragListener with the specified Graves plugin. -
Method Summary
Modifier and TypeMethodDescriptionprivate booleancheckIfXPGivingInventory(org.bukkit.event.inventory.InventoryType inventoryType) Checks if the inventory type is one that grants XP (e.g., Furnace, Anvil, Grindstone).private UUIDgetGraveUUIDFromItemStack(org.bukkit.inventory.ItemStack itemStack) Retrieves the Grave UUID from the item stack.private voidhandleGraveInventoryDrag(org.bukkit.event.inventory.InventoryDragEvent event, org.bukkit.entity.Player player, Grave grave) Handles inventory drags when the inventory holder is a Grave.private voidhandleGraveListDrag(org.bukkit.event.inventory.InventoryDragEvent event, org.bukkit.entity.Player player, GraveList graveList) Handles inventory drags for GraveList inventories.private voidhandleGraveMenuDrag(org.bukkit.event.inventory.InventoryDragEvent event, org.bukkit.entity.Player player, GraveMenu graveMenu) Handles inventory drags for GraveMenu inventories.private voidhandlePlayerInventoryDrag(org.bukkit.event.inventory.InventoryDragEvent event, org.bukkit.entity.Player player, org.bukkit.inventory.InventoryHolder inventoryHolder) Handles inventory drags when the player interacts with GraveList or GraveMenu inventories.private voidisCompassItem(org.bukkit.event.inventory.InventoryDragEvent event) Checks if a specific type of compass (e.g., RECOVERY_COMPASS) was dragged into the player's inventory.voidonInventoryDrag(org.bukkit.event.inventory.InventoryDragEvent event) Handles the InventoryDragEvent to perform actions based on the type of inventory holder.
-
Field Details
-
plugin
-
-
Constructor Details
-
InventoryDragListener
Constructs an InventoryDragListener with the specified Graves plugin.- Parameters:
plugin- The Graves plugin instance.
-
-
Method Details
-
onInventoryDrag
public void onInventoryDrag(org.bukkit.event.inventory.InventoryDragEvent event) Handles the InventoryDragEvent to perform actions based on the type of inventory holder. Updates grave inventories and handles interactions with GraveList and GraveMenu inventories.- Parameters:
event- The InventoryDragEvent to handle.
-
isCompassItem
private void isCompassItem(org.bukkit.event.inventory.InventoryDragEvent event) Checks if a specific type of compass (e.g., RECOVERY_COMPASS) was dragged into the player's inventory.- Parameters:
event- The InventoryDragEvent to check.
-
handleGraveInventoryDrag
private void handleGraveInventoryDrag(org.bukkit.event.inventory.InventoryDragEvent event, org.bukkit.entity.Player player, Grave grave) Handles inventory drags when the inventory holder is a Grave.- Parameters:
event- The InventoryDragEvent.player- The player dragging items.grave- The Grave inventory holder.
-
handlePlayerInventoryDrag
private void handlePlayerInventoryDrag(org.bukkit.event.inventory.InventoryDragEvent event, org.bukkit.entity.Player player, org.bukkit.inventory.InventoryHolder inventoryHolder) Handles inventory drags when the player interacts with GraveList or GraveMenu inventories.- Parameters:
event- The InventoryDragEvent.player- The player dragging items.inventoryHolder- The inventory holder.
-
checkIfXPGivingInventory
private boolean checkIfXPGivingInventory(org.bukkit.event.inventory.InventoryType inventoryType) Checks if the inventory type is one that grants XP (e.g., Furnace, Anvil, Grindstone).- Parameters:
inventoryType- The type of the inventory.- Returns:
- true if the inventory grants XP, false otherwise.
-
handleGraveListDrag
private void handleGraveListDrag(org.bukkit.event.inventory.InventoryDragEvent event, org.bukkit.entity.Player player, GraveList graveList) Handles inventory drags for GraveList inventories.- Parameters:
event- The InventoryDragEvent.player- The player dragging items.graveList- The GraveList inventory holder.
-
handleGraveMenuDrag
private void handleGraveMenuDrag(org.bukkit.event.inventory.InventoryDragEvent event, org.bukkit.entity.Player player, GraveMenu graveMenu) Handles inventory drags for GraveMenu inventories.- Parameters:
event- The InventoryDragEvent.player- The player dragging items.graveMenu- The GraveMenu inventory holder.
-
getGraveUUIDFromItemStack
Retrieves the Grave UUID from the item stack.- Parameters:
itemStack- The item stack to check.- Returns:
- The UUID of the grave associated with the item stack, or null if not found.
-