Class EntityExplodeListener

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

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

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

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

    Modifier and Type
    Method
    Description
    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.
    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
    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

    • EntityExplodeListener

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

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