Class GraveEntityEvent

java.lang.Object
org.bukkit.event.Event
dev.cwhead.GravesX.event.graveevent.GraveEvent
dev.cwhead.GravesX.event.graveevent.GraveEntityEvent
All Implemented Interfaces:
Addon, org.bukkit.event.Cancellable
Direct Known Subclasses:
GraveAutoLootEvent, GraveCreateEvent, GravePlayerEvent, GravePreTeleportEvent, GraveProjectileHitEvent, GraveProtectionCreateEvent, GraveTeleportEvent, GraveWalkOverEvent

public class GraveEntityEvent extends GraveEvent
Entity-based grave event.

This subclass provides accessors for entity-related details (entity, living entity, killer/target, etc.).

  • Constructor Details

    • GraveEntityEvent

      public GraveEntityEvent(@NotNull @NotNull Grave grave, @NotNull @NotNull org.bukkit.entity.Entity entity, @Nullable @Nullable org.bukkit.Location location, @Nullable BlockData.BlockType blockType, @Nullable @Nullable org.bukkit.block.Block block, @Nullable @Nullable org.bukkit.entity.LivingEntity livingEntity, @Nullable @Nullable org.bukkit.entity.LivingEntity targetEntity)
      Constructs a new GraveEntityEvent.
      Parameters:
      grave - The grave associated with the event.
      entity - The entity involved in the event (non-null).
      location - The location of the event.
      blockType - The type of block involved in the event, if any.
      block - The block involved in the event, if any.
      livingEntity - The living entity associated with the event, if any.
      targetEntity - The entity targeted by the event, if any.
  • Method Details

    • getEntity

      @NotNull public @NotNull org.bukkit.entity.Entity getEntity()
      Gets the entity involved in the event.
      Returns:
      The entity involved in the event.
    • getEntityName

      @NotNull public @NotNull String getEntityName()
      Gets the entity name in the event.
      Returns:
      The entity name involved in the event.
    • getEntityCustomName

      @NotNull public @NotNull String getEntityCustomName()
      Gets the entity custom name in the event.
      Returns:
      The entity custom name involved in the event.
      Throws:
      GravesXEventMethodNotSupportedException - if the entity has no custom name
    • getEntityUniqueId

      @NotNull public @NotNull UUID getEntityUniqueId()
      Gets the entity unique ID involved in the event.
      Returns:
      The entity unique ID involved in the event.
    • getTargetEntity

      @Nullable public @Nullable org.bukkit.entity.LivingEntity getTargetEntity()
      Gets the entity targeted by the event.
      Returns:
      The target entity, or null if not applicable.
    • getEntityType

      @Nullable public @Nullable org.bukkit.entity.EntityType getEntityType()
      Gets the type of the target entity.
      Returns:
      The type of the target entity, or null if not applicable.
    • isEntityActuallyPlayer

      public boolean isEntityActuallyPlayer()
      Determines if entity in an event is Player or Entity.
      Returns:
      true if player, false otherwise
    • hasLivingEntity

      public boolean hasLivingEntity()
      Checks if there is a living entity associated with the event.
      Returns:
      true if a living entity is present
    • getLivingEntity

      @NotNull public @NotNull org.bukkit.entity.LivingEntity getLivingEntity()
      Gets the living entity associated with the event.
      Returns:
      The living entity
      Throws:
      GravesXEventNullPointerException - if no living entity is present
    • getLivingEntityVictim

      @NotNull public @NotNull String getLivingEntityVictim()
      Gets the living entity victim name associated with the event.
      Returns:
      The victim name
      Throws:
      GravesXEventNullPointerException - if no living entity is present
    • getLivingEntityVictimId

      @NotNull public @NotNull UUID getLivingEntityVictimId()
      Gets the living entity victim uuid associated with the event.
      Returns:
      The victim UUID
      Throws:
      GravesXEventNullPointerException - if no living entity is present
    • hasKiller

      public boolean hasKiller()
      Checks if the living entity has a killer associated with the event.
      Returns:
      true if a killer is present
    • getLivingEntityKiller

      @NotNull public @NotNull org.bukkit.entity.LivingEntity getLivingEntityKiller()
      Gets the living entity killer associated with the event.
      Returns:
      The killer as a LivingEntity
      Throws:
      GravesXEventNullPointerException - if no killer is present
    • getLivingEntityKillerName

      @NotNull public @NotNull String getLivingEntityKillerName()
      Gets the killer's name.
      Returns:
      The killer name
      Throws:
      GravesXEventNullPointerException - if no killer is present
    • getLivingEntityKillerUniqueId

      @NotNull public @NotNull UUID getLivingEntityKillerUniqueId()
      Gets the killer's unique ID.
      Returns:
      The killer UUID
      Throws:
      GravesXEventNullPointerException - if no killer is present
    • getLivingEntityVictimType

      @NotNull public @NotNull org.bukkit.entity.EntityType getLivingEntityVictimType()
      Gets the victim entity type.
      Returns:
      The victim type
      Throws:
      GravesXEventNullPointerException - if no living entity is present
    • getLivingEntityKillerType

      @NotNull public @NotNull org.bukkit.entity.EntityType getLivingEntityKillerType()
      Gets the killer entity type.
      Returns:
      The killer type
      Throws:
      GravesXEventNullPointerException - if no killer is present
    • hasPlayer

      public boolean hasPlayer()
    • getPlayer

      @Nullable public @Nullable org.bukkit.entity.Player getPlayer()
    • 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 static list of handlers for this event.
      Returns:
      The static handler list for this event.