Class ProjectileHitBlockEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.entity.EntityEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class ProjectileHitBlockEvent extends ProjectileEvent implements org.bukkit.event.Cancellable
Called whenever a WeaponProjectile hits a block. This may be called multiple times for some projectiles (that use Through or Bouncy).

For more control over the projectile, consider using a ProjectileScript instead.

  • Constructor Details

    • ProjectileHitBlockEvent

      public ProjectileHitBlockEvent(WeaponProjectile projectile, org.bukkit.block.Block block, org.bukkit.block.BlockFace hitBlockFace, org.bukkit.util.Vector exactLocation)
  • Method Details

    • getBlock

      public org.bukkit.block.Block getBlock()
      Returns the block that was hit by the projectile.
      Returns:
      The non-null bukkit block that was hit.
    • getHitFace

      public org.bukkit.block.BlockFace getHitFace()
      Returns the face of the block that was hit by the projectile.
      Returns:
      The non-null hit block face.
    • getHitLocation

      public org.bukkit.Location getHitLocation()
      Returns the exact* location where the projectile's ray collides with the block's bounding box.
      Returns:
      The non-null collision point
    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
    • setCancelled

      public void setCancelled(boolean cancelled)
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
    • getHandlers

      @NotNull public org.bukkit.event.HandlerList getHandlers()
      Specified by:
      getHandlers in class org.bukkit.event.Event
    • getHandlerList

      public static org.bukkit.event.HandlerList getHandlerList()