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 voidcheckCompassDrag(org.bukkit.event.inventory.InventoryDragEvent event) Checks if a specific type of compass (e.g., RECOVERY_COMPASS) was dragged into the player's inventory.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 holder) Handles inventory drags when the player interacts with GraveList or GraveMenu inventories.private booleanisXpGivingInventory(org.bukkit.event.inventory.InventoryType type) 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.
-
checkCompassDrag
private void checkCompassDrag(org.bukkit.event.inventory.InventoryDragEvent event) Checks if a specific type of compass (e.g., RECOVERY_COMPASS) was dragged into the player's inventory. -
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. -
handlePlayerInventoryDrag
private void handlePlayerInventoryDrag(org.bukkit.event.inventory.InventoryDragEvent event, org.bukkit.entity.Player player, org.bukkit.inventory.InventoryHolder holder) Handles inventory drags when the player interacts with GraveList or GraveMenu inventories. -
isXpGivingInventory
private boolean isXpGivingInventory(org.bukkit.event.inventory.InventoryType type) - Returns:
- true if the inventory type grants XP (e.g., Furnace, Anvil, Grindstone).
-
handleGraveListDrag
private void handleGraveListDrag(org.bukkit.event.inventory.InventoryDragEvent event, org.bukkit.entity.Player player, GraveList graveList) Handles inventory drags for GraveList inventories. -
handleGraveMenuDrag
private void handleGraveMenuDrag(org.bukkit.event.inventory.InventoryDragEvent event, org.bukkit.entity.Player player, GraveMenu graveMenu) Handles inventory drags for GraveMenu inventories. -
getGraveUUIDFromItemStack
Retrieves the Grave UUID from the item stack.- Returns:
- The UUID of the grave associated with the item stack, or null if not found.
-