Class ExplosionPrimeListener

java.lang.Object
com.ranull.graves.listener.ExplosionPrimeListener
All Implemented Interfaces:
org.bukkit.event.Listener

public class ExplosionPrimeListener extends Object implements org.bukkit.event.Listener
Listens for ExplosionPrimeEvent to handle interactions with grave blocks when an explosion is triggered.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Graves
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new ExplosionPrimeListener with the specified Graves plugin.
  • Method Summary

    Modifier and Type
    Method
    Description
    private 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
    Checks if the grave should explode based on the configuration.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • plugin

      private final Graves plugin
  • Constructor Details

    • ExplosionPrimeListener

      public ExplosionPrimeListener(Graves plugin)
      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

      private boolean shouldExplode(Grave grave)
      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.