Package com.ranull.graves.listener
Class PlayerDropItemListener
java.lang.Object
com.ranull.graves.listener.PlayerDropItemListener
- All Implemented Interfaces:
org.bukkit.event.Listener
Listener for handling PlayerDropItemEvent to prevent dropping items associated with graves.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPlayerDropItemListener
(Graves plugin) Constructs a PlayerDropItemListener with the specified Graves plugin. -
Method Summary
Modifier and TypeMethodDescriptionprivate 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 remove items from the world if they are associated with graves.
-
Field Details
-
plugin
-
-
Constructor Details
-
PlayerDropItemListener
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 remove items from the world if they 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 is removed from the world.- 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.
-