Package com.ranull.graves.listener
Class ExplosionPrimeListener
java.lang.Object
com.ranull.graves.listener.ExplosionPrimeListener
- All Implemented Interfaces:
org.bukkit.event.Listener
Listens for ExplosionPrimeEvent to handle interactions with grave blocks when an explosion is triggered.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionExplosionPrimeListener
(Graves plugin) Constructs a new ExplosionPrimeListener with the specified Graves plugin. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
handleGraveExplosion
(org.bukkit.event.entity.ExplosionPrimeEvent event, Grave grave, org.bukkit.Location graveLocation) Handles the explosion of a grave.private boolean
isWithinCube
(org.bukkit.Location loc1, org.bukkit.Location loc2, int radius) Checks if the explosion location is within a cube around the grave location.void
onExplosionPrime
(org.bukkit.event.entity.ExplosionPrimeEvent event) Handles ExplosionPrimeEvent to manage grave interactions when an explosion is initiated near graves.private boolean
shouldExplode
(Grave grave) Checks if the grave should explode based on the configuration.
-
Field Details
-
plugin
-
-
Constructor Details
-
ExplosionPrimeListener
Constructs a new ExplosionPrimeListener with the specified Graves plugin.- Parameters:
plugin
- The Graves plugin instance.
-
-
Method Details
-
onExplosionPrime
public void onExplosionPrime(org.bukkit.event.entity.ExplosionPrimeEvent event) Handles ExplosionPrimeEvent to manage grave interactions when an explosion is initiated near graves.- Parameters:
event
- The ExplosionPrimeEvent to handle.
-
isWithinCube
private boolean isWithinCube(org.bukkit.Location loc1, org.bukkit.Location loc2, int radius) Checks if the explosion location is within a cube around the grave location.- Parameters:
loc1
- The explosion location.loc2
- The grave location.radius
- The protection radius.- Returns:
- True if within 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.ExplosionPrimeEvent event, Grave grave, org.bukkit.Location graveLocation) Handles the explosion of a grave.- Parameters:
event
- The ExplosionPrimeEvent.grave
- The grave associated with the explosion.graveLocation
- The location of the grave.
-