Package com.ranull.graves.listener
Class BlockBreakListener
java.lang.Object
com.ranull.graves.listener.BlockBreakListener
- All Implemented Interfaces:
org.bukkit.event.Listener
Listens for BlockBreakEvent to handle interactions with grave blocks and
prevent block breaking within a specified radius of a grave.
-
Constructor Summary
ConstructorsConstructorDescriptionBlockBreakListener
(Graves plugin) Constructs a new BlockBreakListener with the specified Graves plugin. -
Method Summary
Modifier and TypeMethodDescriptionvoid
onBlockBreak
(org.bukkit.event.block.BlockBreakEvent event) Handles BlockBreakEvent to manage interactions with grave blocks when a block is broken.
-
Constructor Details
-
BlockBreakListener
Constructs a new BlockBreakListener with the specified Graves plugin.- Parameters:
plugin
- The Graves plugin instance.
-
-
Method Details
-
onBlockBreak
public void onBlockBreak(org.bukkit.event.block.BlockBreakEvent event) Handles BlockBreakEvent to manage interactions with grave blocks when a block is broken. Checks if the broken block is associated with a grave. If so, verifies if breaking the grave is allowed and if the player has permission to do so. If not a grave block, it checks if the block is within a 15-block radius of any grave and cancels the event if so.- Parameters:
event
- The BlockBreakEvent to handle.
-