Class InventoryCloseListener

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

public class InventoryCloseListener extends Object implements org.bukkit.event.Listener
Listener for handling InventoryCloseEvent to manage actions when a grave inventory is closed.
  • Field Summary

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

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

    Modifier and Type
    Method
    Description
    private void
    callGraveCloseEvent(org.bukkit.event.inventory.InventoryCloseEvent event, Grave grave, org.bukkit.entity.Player player)
    Fires the custom GraveCloseEvent (modern + legacy).
    private void
    handleEmptyGrave(org.bukkit.event.inventory.InventoryCloseEvent event, org.bukkit.entity.Player player, Grave grave)
    Handles actions for an empty (fully looted) grave.
    private boolean
     
    void
    onInventoryClose(org.bukkit.event.inventory.InventoryCloseEvent event)
    Handles the InventoryCloseEvent to perform actions when a grave inventory is closed.

    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

    • InventoryCloseListener

      public InventoryCloseListener(Graves plugin)
      Constructs an InventoryCloseListener with the specified Graves plugin.
      Parameters:
      plugin - The Graves plugin instance.
  • Method Details

    • onInventoryClose

      public void onInventoryClose(org.bukkit.event.inventory.InventoryCloseEvent event)
      Handles the InventoryCloseEvent to perform actions when a grave inventory is closed. Calls a custom GraveCloseEvent and manages the state of the grave based on its item amount.
      Parameters:
      event - The InventoryCloseEvent to handle.
    • callGraveCloseEvent

      private void callGraveCloseEvent(org.bukkit.event.inventory.InventoryCloseEvent event, Grave grave, org.bukkit.entity.Player player)
      Fires the custom GraveCloseEvent (modern + legacy).
    • isEmptyGrave

      private boolean isEmptyGrave(Grave grave)
      Returns:
      True if the grave has no items remaining.
    • handleEmptyGrave

      private void handleEmptyGrave(org.bukkit.event.inventory.InventoryCloseEvent event, org.bukkit.entity.Player player, Grave grave)
      Handles actions for an empty (fully looted) grave.