Package dev.cwhead.GravesX.event
Class GraveCreateEvent
java.lang.Object
org.bukkit.event.Event
dev.cwhead.GravesX.event.graveevent.GraveEvent
dev.cwhead.GravesX.event.graveevent.GraveEntityEvent
dev.cwhead.GravesX.event.GraveCreateEvent
- All Implemented Interfaces:
Addon,org.bukkit.event.Cancellable
- Direct Known Subclasses:
GraveCreateEvent
Represents an event that occurs when a grave is created for an entity.
This event extends GraveEntityEvent and is cancellable, allowing event listeners
to prevent the creation of the grave if necessary.
-
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
ConstructorsConstructorDescriptionGraveCreateEvent(@NotNull org.bukkit.entity.Entity entity, @NotNull Grave grave) Constructs a newGraveCreateEventwithout any ignored items/blocks information.GraveCreateEvent(@NotNull org.bukkit.entity.Entity entity, @NotNull Grave grave, @Nullable Collection<org.bukkit.inventory.ItemStack> ignoredItems, @Nullable Collection<org.bukkit.block.Block> ignoredBlocks) Backwards-compatible constructor (no grave items provided).GraveCreateEvent(@NotNull org.bukkit.entity.Entity entity, @NotNull Grave grave, @Nullable Collection<org.bukkit.inventory.ItemStack> graveItemStackList, @Nullable Collection<org.bukkit.inventory.ItemStack> ignoredItems, @Nullable Collection<org.bukkit.block.Block> ignoredBlocks) Constructs a newGraveCreateEventwith ignored items and blocks. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddIgnoredBlock(@Nullable org.bukkit.block.Block block) Adds a single block to the ignored blocks list for this grave creation.voidaddIgnoredItem(@Nullable org.bukkit.inventory.ItemStack item) Adds a single item to the ignored items list for this grave creation.@NotNull Collection<org.bukkit.inventory.ItemStack> Gets the items intended to be stored in the grave.static @NotNull org.bukkit.event.HandlerListGets the static list of handlers for this event.@NotNull org.bukkit.event.HandlerListGets the list of handlers for this event.@NotNull Collection<org.bukkit.block.Block> Gets the blocks that were ignored when creating this grave.@NotNull Collection<org.bukkit.inventory.ItemStack> Gets the items that were ignored (not stored) when creating this grave.booleanremoveIgnoredBlock(@Nullable org.bukkit.block.Block block) Removes a single block from the ignored blocks list for this grave creation.booleanremoveIgnoredItem(@Nullable org.bukkit.inventory.ItemStack item) Removes a single item from the ignored items list for this grave creation.voidsetGraveItemStackList(@Nullable Collection<org.bukkit.inventory.ItemStack> graveItemStackList) Sets the items intended to be stored in the grave.voidsetIgnoredBlocks(@Nullable Collection<org.bukkit.block.Block> ignoredBlocks) Sets the blocks that were ignored when creating this grave.voidsetIgnoredItems(@Nullable Collection<org.bukkit.inventory.ItemStack> ignoredItems) Sets the items that were ignored (not stored) when creating this grave.Methods inherited from class dev.cwhead.GravesX.event.graveevent.GraveEntityEvent
getEntity, getEntityCustomName, getEntityName, getEntityType, getEntityUniqueId, getLivingEntity, getLivingEntityKiller, getLivingEntityKillerName, getLivingEntityKillerType, getLivingEntityKillerUniqueId, getLivingEntityVictim, getLivingEntityVictimId, getLivingEntityVictimType, getPlayer, getTargetEntity, hasKiller, hasLivingEntity, hasPlayer, isEntityActuallyPlayerMethods 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, setLocationMethods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
Constructor Details
-
GraveCreateEvent
public GraveCreateEvent(@NotNull @NotNull org.bukkit.entity.Entity entity, @NotNull @NotNull Grave grave) Constructs a newGraveCreateEventwithout any ignored items/blocks information.This constructor is kept for backwards compatibility. It simply delegates to the full constructor with
nullcollections.- Parameters:
entity- The entity for which the grave is being created.grave- The grave being created.
-
GraveCreateEvent
public GraveCreateEvent(@NotNull @NotNull org.bukkit.entity.Entity entity, @NotNull @NotNull Grave grave, @Nullable @Nullable Collection<org.bukkit.inventory.ItemStack> graveItemStackList, @Nullable @Nullable Collection<org.bukkit.inventory.ItemStack> ignoredItems, @Nullable @Nullable Collection<org.bukkit.block.Block> ignoredBlocks) Constructs a newGraveCreateEventwith ignored items and blocks.- Parameters:
entity- The entity for which the grave is being created.grave- The grave being created.graveItemStackList- Items intended to be stored in the grave (may benullor empty).ignoredItems- Items that were not stored in the grave (may benullor empty).ignoredBlocks- Blocks that were ignored for this grave (may benullor empty).
-
GraveCreateEvent
public GraveCreateEvent(@NotNull @NotNull org.bukkit.entity.Entity entity, @NotNull @NotNull Grave grave, @Nullable @Nullable Collection<org.bukkit.inventory.ItemStack> ignoredItems, @Nullable @Nullable Collection<org.bukkit.block.Block> ignoredBlocks) Backwards-compatible constructor (no grave items provided).- Parameters:
entity- The entity for which the grave is being created.grave- The grave being created.ignoredItems- Items that were not stored in the grave (may benullor empty).ignoredBlocks- Blocks that were ignored for this grave (may benullor empty).
-
-
Method Details
-
getGraveItemStackList
Gets the items intended to be stored in the grave.- Returns:
- An unmodifiable collection of grave items, or an empty collection if none.
-
setGraveItemStackList
public void setGraveItemStackList(@Nullable @Nullable Collection<org.bukkit.inventory.ItemStack> graveItemStackList) Sets the items intended to be stored in the grave.- Parameters:
graveItemStackList- Items intended to be stored in the grave (may benullor empty).
-
getIgnoredItems
Gets the items that were ignored (not stored) when creating this grave.- Returns:
- An unmodifiable collection of ignored items, or an empty collection if none.
-
setIgnoredItems
public void setIgnoredItems(@Nullable @Nullable Collection<org.bukkit.inventory.ItemStack> ignoredItems) Sets the items that were ignored (not stored) when creating this grave.- Parameters:
ignoredItems- Items that were not stored in the grave (may benullor empty).
-
addIgnoredItem
public void addIgnoredItem(@Nullable @Nullable org.bukkit.inventory.ItemStack item) Adds a single item to the ignored items list for this grave creation.If the internal collection is
null, it will be created.- Parameters:
item- The item to add to the ignored items list (may benull, in which case this call is a no-op).
-
removeIgnoredItem
public boolean removeIgnoredItem(@Nullable @Nullable org.bukkit.inventory.ItemStack item) Removes a single item from the ignored items list for this grave creation.- Parameters:
item- The item to remove from the ignored items list (may benull, in which case this call is a no-op).- Returns:
trueif the item was present and removed;falseotherwise.
-
getIgnoredBlocks
Gets the blocks that were ignored when creating this grave.- Returns:
- An unmodifiable collection of ignored blocks, or an empty collection if none.
-
setIgnoredBlocks
Sets the blocks that were ignored when creating this grave.- Parameters:
ignoredBlocks- Blocks that were ignored for this grave (may benullor empty).
-
addIgnoredBlock
public void addIgnoredBlock(@Nullable @Nullable org.bukkit.block.Block block) Adds a single block to the ignored blocks list for this grave creation.If the internal collection is
null, it will be created.- Parameters:
block- The block to add to the ignored blocks list (may benull, in which case this call is a no-op).
-
removeIgnoredBlock
public boolean removeIgnoredBlock(@Nullable @Nullable org.bukkit.block.Block block) Removes a single block from the ignored blocks list for this grave creation.- Parameters:
block- The block to remove from the ignored blocks list (may benull, in which case this call is a no-op).- Returns:
trueif the block was present and removed;falseotherwise.
-
getHandlers
@NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()Gets the list of handlers for this event.- Overrides:
getHandlersin classGraveEntityEvent- 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.
-