Class InventoryDragListener

java.lang.Object
com.ranull.graves.listener.InventoryDragListener
All Implemented Interfaces:
org.bukkit.event.Listener

public class InventoryDragListener extends Object implements org.bukkit.event.Listener
Listener for handling InventoryDragEvent to manage grave-related inventory interactions.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Graves
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an InventoryDragListener with the specified Graves plugin.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    private UUID
    getGraveUUIDFromItemStack(org.bukkit.inventory.ItemStack itemStack)
    Retrieves the Grave UUID from the item stack.
    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.
    private void
    handleGraveListDrag(org.bukkit.event.inventory.InventoryDragEvent event, org.bukkit.entity.Player player, GraveList graveList)
    Handles inventory drags for GraveList inventories.
    private void
    handleGraveMenuDrag(org.bukkit.event.inventory.InventoryDragEvent event, org.bukkit.entity.Player player, GraveMenu graveMenu)
    Handles inventory drags for GraveMenu inventories.
    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.
    private boolean
    isXpGivingInventory(org.bukkit.event.inventory.InventoryType type)
     
    void
    onInventoryDrag(org.bukkit.event.inventory.InventoryDragEvent event)
    Handles the InventoryDragEvent to perform actions based on the type of inventory holder.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • plugin

      private final Graves plugin
  • Constructor Details

    • InventoryDragListener

      public InventoryDragListener(Graves plugin)
      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

      private UUID getGraveUUIDFromItemStack(org.bukkit.inventory.ItemStack itemStack)
      Retrieves the Grave UUID from the item stack.
      Returns:
      The UUID of the grave associated with the item stack, or null if not found.