Class GraveBlockPlaceEvent

java.lang.Object
org.bukkit.event.Event
dev.cwhead.GravesX.event.graveevent.GraveEvent
dev.cwhead.GravesX.event.GraveBlockPlaceEvent
All Implemented Interfaces:
Addon, org.bukkit.event.Cancellable
Direct Known Subclasses:
GraveBlockPlaceEvent

public class GraveBlockPlaceEvent extends GraveEvent
Represents an event that occurs when a grave is placed by a LivingEntity whether that be a Player or Entity.

This event extends GraveEvent and provides information about the grave and the LivingEntity (Player or Entity) involved when the grave is placed.

  • Field Details

    • HANDLERS

      private static final org.bukkit.event.HandlerList HANDLERS
      A static final instance of HandlerList used to manage event handlers.

      This HandlerList is used to register and manage the handlers for events of this type. It provides the mechanism for adding, removing, and invoking event handlers.

    • livingEntity

      @Nullable private final @Nullable org.bukkit.entity.LivingEntity livingEntity
      The Killer (if known).
  • Constructor Details

    • GraveBlockPlaceEvent

      public GraveBlockPlaceEvent(@NotNull @NotNull Grave grave, @NotNull @NotNull org.bukkit.Location location, @Nullable BlockData.BlockType blockType, @Nullable @Nullable org.bukkit.block.Block block, @Nullable @Nullable org.bukkit.entity.LivingEntity livingEntity)
      Constructs a new GraveBlockPlaceEvent.
      Parameters:
      grave - The grave associated with the event.
      location - The location where the block is being placed.
      blockType - The type of the block being placed.
      block - The block being placed.
      livingEntity - The Killer
    • GraveBlockPlaceEvent

      @Deprecated public GraveBlockPlaceEvent(@NotNull @NotNull Grave grave, @NotNull @NotNull org.bukkit.Location location, @Nullable BlockData.BlockType blockType)
      Deprecated.
      Parameters:
      grave - The grave associated with the event.
      location - The location where the block is being placed.
      blockType - The type of the block being placed.
  • Method Details

    • hasEntity

      public boolean hasEntity()
      Check if there is an entity
      Returns:
      true if any entity is associated with this event.
    • getEntity

      @NotNull public @NotNull org.bukkit.entity.Entity getEntity()
      Gets Entity
      Returns:
      the associated entity (killer) or throws if absent.
      Throws:
      GravesXEventNullPointerException - if no entity is present.
    • getKiller

      @NotNull public @NotNull org.bukkit.entity.LivingEntity getKiller()
      Gets the killer
      Returns:
      the killer or throws if absent.
      Throws:
      GravesXEventNullPointerException - if no LivingEntity or LivingEntity.getKiller() is present.
    • getKillerName

      @NotNull public @NotNull String getKillerName()
      Gets the killer name
      Returns:
      the killer name or throws if absent.
      Throws:
      GravesXEventNullPointerException - if no killer is present.
    • getKillerUniqueId

      @NotNull public @NotNull UUID getKillerUniqueId()
      Gets the Killers Unique ID
      Returns:
      the killer unique ID or throws if absent.
      Throws:
      GravesXEventNullPointerException - if no killer is present.
    • hasKiller

      public boolean hasKiller()
      Checks if there is a killer
      Returns:
      true if a killer is associated with this event.
    • hasPlayer

      public boolean hasPlayer()
      Check if there is a player.
      Returns:
      true if the killer is a Player and still references a valid Player object.
    • getPlayer

      public org.bukkit.entity.Player getPlayer()
      Gets the player
      Returns:
      the player (killer) or throws if absent.
      Throws:
      GravesXEventNullPointerException - if the killer is not a player.
    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Gets the list of handlers for this event.
      Overrides:
      getHandlers in class GraveEvent
      Returns:
      The handler list for this event.
    • getHandlerList

      @NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList()
      Gets the list of handlers for this event.
      Returns:
      The handler list for this event.