Class PlayerDropItemListener

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

public class PlayerDropItemListener extends Object implements org.bukkit.event.Listener
Listener for handling PlayerDropItemEvent to prevent dropping items associated with graves.
  • Field Summary

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

    Constructors
    Constructor
    Description
    Constructs a PlayerDropItemListener with the specified Graves plugin.
  • Method Summary

    Modifier and Type
    Method
    Description
    private boolean
    isGraveItem(org.bukkit.inventory.ItemStack itemStack)
    Checks if the item stack is associated with a grave.
    void
    onPlayerDropItem(org.bukkit.event.player.PlayerDropItemEvent event)
    Handles the PlayerDropItemEvent to prevent dropping items that are associated with graves.

    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

    • PlayerDropItemListener

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

    • onPlayerDropItem

      public void onPlayerDropItem(org.bukkit.event.player.PlayerDropItemEvent event)
      Handles the PlayerDropItemEvent to prevent dropping items that are associated with graves. If the dropped item is linked to a grave (i.e., it has a grave UUID associated with it), the item drop is cancelled and the item entity is removed to avoid dupes or desyncs.
      Parameters:
      event - The PlayerDropItemEvent to handle.
    • isGraveItem

      private boolean isGraveItem(org.bukkit.inventory.ItemStack itemStack)
      Checks if the item stack is associated with a grave.
      Parameters:
      itemStack - The item stack to check.
      Returns:
      True if the item stack is associated with a grave, false otherwise.