Class BlockExplodeListener

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

public class BlockExplodeListener extends Object implements org.bukkit.event.Listener
Listens for BlockExplodeEvent to handle interactions with grave blocks when they are affected by block explosions.
  • Field Summary

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

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

    Modifier and Type
    Method
    Description
    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.
    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
    onBlockExplode(org.bukkit.event.block.BlockExplodeEvent event)
    Handles BlockExplodeEvent to manage grave interactions when blocks are exploded by other blocks.
    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

    • BlockExplodeListener

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

      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.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.