Package dev.cwhead.GravesX.event
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
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.
-
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
ConstructorsConstructorDescriptionGraveBlockPlaceEvent
(@NotNull Grave grave, @NotNull org.bukkit.Location location, BlockData.BlockType blockType) Deprecated.GraveBlockPlaceEvent
(@NotNull Grave grave, @NotNull org.bukkit.Location location, BlockData.BlockType blockType, @Nullable org.bukkit.block.Block block, @Nullable org.bukkit.entity.LivingEntity livingEntity) Constructs a new GraveBlockPlaceEvent. -
Method Summary
Modifier and TypeMethodDescription@NotNull org.bukkit.entity.Entity
Gets Entitystatic @NotNull org.bukkit.event.HandlerList
Gets the 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 killer@NotNull String
Gets the killer name@NotNull UUID
Gets the Killers Unique IDorg.bukkit.entity.Player
Gets the playerboolean
Check if there is an entityboolean
Checks if there is a killerboolean
Check if there is a player.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
-
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.UseGraveBlockPlaceEvent(Grave, Location, BlockData.BlockType, Block, LivingEntity)
instead. 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.
-
-
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 noLivingEntity
orLivingEntity.getKiller()
is present.
-
getKillerName
Gets the killer name- Returns:
- the killer name or throws if absent.
- Throws:
GravesXEventNullPointerException
- if no killer is present.
-
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 classGraveEvent
- 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.
-
GraveBlockPlaceEvent(Grave, Location, BlockData.BlockType, Block, LivingEntity)
instead.