Package dev.cwhead.GravesX.event
Class GraveVirtualOpenEvent
java.lang.Object
org.bukkit.event.Event
dev.cwhead.GravesX.event.graveevent.GraveEvent
dev.cwhead.GravesX.event.graveevent.GraveEntityEvent
dev.cwhead.GravesX.event.GraveVirtualOpenEvent
- All Implemented Interfaces:
Addon,org.bukkit.event.Cancellable
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.
-
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
ConstructorsConstructorDescriptionGraveVirtualOpenEvent(@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, double distance, double maxDistance) Constructs a newGraveVirtualOpenEvent. -
Method Summary
Modifier and TypeMethodDescriptiondoubleGets the actual distance between the entity and the grave location.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.doubleGets the maximum allowed distance for this event.voidsetMaxDistance(double maxDistance) Sets the maximum allowed distance for this event.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
-
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 newGraveVirtualOpenEvent.- 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:
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.
-