Package com.ranull.graves.listener
Class BlockExplodeListener
java.lang.Object
com.ranull.graves.listener.BlockExplodeListener
- All Implemented Interfaces:
org.bukkit.event.Listener
Listens for BlockExplodeEvent to handle interactions with grave blocks when they are affected by block explosions.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBlockExplodeListener(Graves plugin) Constructs a new BlockExplodeListener with the specified Graves plugin. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidhandleGraveExplosion(org.bukkit.event.block.BlockExplodeEvent event, Iterator<org.bukkit.block.Block> iterator, org.bukkit.block.Block block, Grave grave, org.bukkit.Location location) Handles the explosion of a grave.private booleanisWithinCube(org.bukkit.Location center, org.bukkit.Location target, int radius) Checks if a given location is within a cubic protection radius.voidonBlockExplode(org.bukkit.event.block.BlockExplodeEvent event) Handles BlockExplodeEvent to manage grave interactions when blocks are exploded by other blocks.private booleanshouldExplode(Grave grave) Checks if the grave should explode based on the configuration.
-
Field Details
-
plugin
-
-
Constructor Details
-
BlockExplodeListener
Constructs a new BlockExplodeListener with the specified Graves plugin.- Parameters:
plugin- The Graves plugin instance.
-
-
Method Details
-
onBlockExplode
public void onBlockExplode(org.bukkit.event.block.BlockExplodeEvent event) Handles BlockExplodeEvent to manage grave interactions when blocks are exploded by other blocks.- Parameters:
event- The BlockExplodeEvent to handle.
-
isWithinCube
private boolean isWithinCube(org.bukkit.Location center, org.bukkit.Location target, int radius) Checks if a given location is within a cubic protection radius.- Parameters:
center- The center of the cube (grave location).target- The target location to check.radius- The protection radius.- Returns:
- True if the target is inside the cube, false otherwise.
-
shouldExplode
Checks if the grave should explode based on the configuration.- Parameters:
grave- The grave to check.- Returns:
- True if the grave should explode, false otherwise.
-
handleGraveExplosion
private void handleGraveExplosion(org.bukkit.event.block.BlockExplodeEvent event, Iterator<org.bukkit.block.Block> iterator, org.bukkit.block.Block block, Grave grave, org.bukkit.Location location) Handles the explosion of a grave.- Parameters:
event- The BlockExplodeEvent.iterator- The iterator for the blocks in the explosion.block- The block that exploded.grave- The grave associated with the block.location- The location of the grave.
-