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
Entity-based grave event.
This subclass provides accessors for entity-related details (entity, living entity, killer/target, etc.).
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result
-
Field Summary
Fields inherited from class dev.cwhead.GravesX.event.graveevent.GraveEvent
block, blockType, grave, location
-
Constructor Summary
ConstructorsConstructorDescriptionGraveEntityEvent
(@NotNull Grave grave, @NotNull org.bukkit.entity.Entity entity, @Nullable org.bukkit.Location location, BlockData.BlockType blockType, @Nullable org.bukkit.block.Block block, @Nullable org.bukkit.entity.LivingEntity livingEntity, @Nullable org.bukkit.entity.LivingEntity targetEntity) Constructs a newGraveEntityEvent
. -
Method Summary
Modifier and TypeMethodDescription@NotNull org.bukkit.entity.Entity
Gets the entity involved in the event.@NotNull String
Gets the entity custom name in the event.@NotNull String
Gets the entity name in the event.@Nullable org.bukkit.entity.EntityType
Gets the type of the target entity.@NotNull UUID
Gets the entity unique ID involved in the event.static @NotNull org.bukkit.event.HandlerList
Gets the static list of handlers for this event.@NotNull org.bukkit.event.HandlerList
Gets the list of handlers for this event.@NotNull org.bukkit.entity.LivingEntity
Gets the living entity associated with the event.@NotNull org.bukkit.entity.LivingEntity
Gets the living entity killer associated with the event.@NotNull String
Gets the killer's name.@NotNull org.bukkit.entity.EntityType
Gets the killer entity type.@NotNull UUID
Gets the killer's unique ID.@NotNull String
Gets the living entity victim name associated with the event.@NotNull UUID
Gets the living entity victim uuid associated with the event.@NotNull org.bukkit.entity.EntityType
Gets the victim entity type.@Nullable org.bukkit.entity.Player
@Nullable org.bukkit.entity.LivingEntity
Gets the entity targeted by the event.boolean
Checks if the living entity has a killer associated with the event.boolean
Checks if there is a living entity associated with the event.boolean
boolean
Determines if entity in an event is Player or Entity.Methods inherited from class dev.cwhead.GravesX.event.graveevent.GraveEvent
getBlock, getBlockExp, getBlockType, getGrave, getGraveExperience, getGraveOwnerDisplayName, getGraveOwnerName, getGraveOwnerNameDisplay, getGraveOwnerTexture, getGraveOwnerTextureSignature, getGraveOwnerUniqueId, getGraveUUID, getLocation, hasBlock, hasBlockType, hasLocation, isAddon, isCancelled, isDropItems, setAddon, setBlockExp, setCancelled, setDropItems, setLocation
Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
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 newGraveEntityEvent
.- 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
Gets the entity name in the event.- Returns:
- The entity name involved in the event.
-
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
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
Gets the living entity victim name associated with the event.- Returns:
- The victim name
- Throws:
GravesXEventNullPointerException
- if no living entity is present
-
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
Gets the killer's name.- Returns:
- The killer name
- Throws:
GravesXEventNullPointerException
- if no killer is present
-
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 classGraveEvent
- 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.
-