Class GraveCreateEvent

All Implemented Interfaces:
Addon, org.bukkit.event.Cancellable
Direct Known Subclasses:
GraveCreateEvent

public class GraveCreateEvent extends GraveEntityEvent
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.

  • Constructor Details

    • GraveCreateEvent

      public GraveCreateEvent(@NotNull @NotNull org.bukkit.entity.Entity entity, @NotNull @NotNull Grave grave)
      Constructs a new GraveCreateEvent without any ignored items/blocks information.

      This constructor is kept for backwards compatibility. It simply delegates to the full constructor with null collections.

      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 new GraveCreateEvent with 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 be null or empty).
      ignoredItems - Items that were not stored in the grave (may be null or empty).
      ignoredBlocks - Blocks that were ignored for this grave (may be null or 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 be null or empty).
      ignoredBlocks - Blocks that were ignored for this grave (may be null or empty).
  • Method Details

    • getGraveItemStackList

      @NotNull public @NotNull Collection<org.bukkit.inventory.ItemStack> 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 be null or empty).
    • getIgnoredItems

      @NotNull public @NotNull Collection<org.bukkit.inventory.ItemStack> 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 be null or 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 be null, 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 be null, in which case this call is a no-op).
      Returns:
      true if the item was present and removed; false otherwise.
    • getIgnoredBlocks

      @NotNull public @NotNull Collection<org.bukkit.block.Block> 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

      public void setIgnoredBlocks(@Nullable @Nullable Collection<org.bukkit.block.Block> ignoredBlocks)
      Sets the blocks that were ignored when creating this grave.
      Parameters:
      ignoredBlocks - Blocks that were ignored for this grave (may be null or 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 be null, 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 be null, in which case this call is a no-op).
      Returns:
      true if the block was present and removed; false otherwise.
    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Gets the list of handlers for this event.
      Overrides:
      getHandlers in class GraveEntityEvent
      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.