Package com.ranull.graves.listener
Class EntityExplodeListener
java.lang.Object
com.ranull.graves.listener.EntityExplodeListener
- All Implemented Interfaces:
org.bukkit.event.Listener
Listens for EntityExplodeEvent to handle interactions with grave blocks when they are affected by entity explosions.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEntityExplodeListener
(Graves plugin) Constructs a new EntityExplodeListener with the specified Graves plugin. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
handleGraveExplosion
(org.bukkit.event.entity.EntityExplodeEvent 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 boolean
isWithinCube
(org.bukkit.Location center, org.bukkit.Location target, int radius) Checks if a given location is within a cubic protection radius.void
onEntityExplode
(org.bukkit.event.entity.EntityExplodeEvent event) Handles EntityExplodeEvent to manage grave interactions when blocks are exploded by entities.private boolean
shouldExplode
(Grave grave) Checks if the grave should explode based on the configuration.
-
Field Details
-
plugin
-
-
Constructor Details
-
EntityExplodeListener
Constructs a new EntityExplodeListener with the specified Graves plugin.- Parameters:
plugin
- The Graves plugin instance.
-
-
Method Details
-
onEntityExplode
public void onEntityExplode(org.bukkit.event.entity.EntityExplodeEvent event) Handles EntityExplodeEvent to manage grave interactions when blocks are exploded by entities.- Parameters:
event
- The EntityExplodeEvent 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.entity.EntityExplodeEvent 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 EntityExplodeEvent.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.
-