Class GraveVirtualOpenEvent

All Implemented Interfaces:
Addon, org.bukkit.event.Cancellable

public class GraveVirtualOpenEvent extends GraveEntityEvent
Called when a virtual grave open is about to be processed.

Extends GraveEntityEvent and adds:

  • The actual distance between the entity and the grave location.
  • A configurable/overridable maximum distance.

If the event is cancelled, the virtual open will not continue.

  • Constructor Details

    • GraveVirtualOpenEvent

      public GraveVirtualOpenEvent(@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, double distance, double maxDistance)
      Constructs a new GraveVirtualOpenEvent.
      Parameters:
      grave - The grave associated with the event.
      entity - The entity attempting to open the grave (non-null).
      location - The location context of the event (often the entity location).
      blockType - The block type involved, if any.
      block - The block involved, if any.
      livingEntity - The living entity associated with the event, if any.
      targetEntity - The target entity of the event, if any.
      distance - The actual distance between the entity and the grave location.
      maxDistance - The maximum allowed distance (negative for unlimited).
  • Method Details

    • getDistance

      public double getDistance()
      Gets the actual distance between the entity and the grave location.
      Returns:
      The actual distance.
    • getMaxDistance

      public double getMaxDistance()
      Gets the maximum allowed distance for this event.

      A negative value means unlimited distance.

      Returns:
      The maximum allowed distance.
    • setMaxDistance

      public void setMaxDistance(double maxDistance)
      Sets the maximum allowed distance for this event.

      A negative value means unlimited distance.

      Parameters:
      maxDistance - New maximum distance.
    • 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.