Class PlayerHeadDropEvent

java.lang.Object
org.bukkit.event.Event
net.mathias2246.buildmc.api.event.CustomEvent
net.mathias2246.buildmc.api.event.player.PlayerHeadDropEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class PlayerHeadDropEvent extends CustomEvent implements org.bukkit.event.Cancellable
Called when a Player's head is about to be dropped after death.

Plugins can listen to this event to:

  • Cancel the head drop
  • Modify the ItemStack representing the head
  • Attach metadata for other plugins to consume
This event is Cancellable.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.bukkit.event.Event

    org.bukkit.event.Event.Result
  • Field Summary

    Fields inherited from class net.mathias2246.buildmc.api.event.CustomEvent

    metadataHolder
  • Constructor Summary

    Constructors
    Constructor
    Description
    PlayerHeadDropEvent(org.bukkit.entity.Player victim, org.bukkit.entity.Player killer, org.bukkit.inventory.ItemStack playerHead, org.bukkit.event.entity.PlayerDeathEvent event)
    Constructs a new PlayerHeadDropEvent.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.event.entity.PlayerDeathEvent
    Gets the PlayerDeathEvent that caused the head to drop.
    static org.bukkit.event.HandlerList
    Gets the static list of handlers for this event type.
    @NotNull org.bukkit.event.HandlerList
    Gets the list of handlers for this event instance.
    org.bukkit.entity.Player
    Gets the killer of the victim.
    org.bukkit.inventory.ItemStack
    Gets the ItemStack representing the player's head.
    org.bukkit.entity.Player
    Gets the victim whose head is being dropped.
    boolean
    Checks whether the event has been cancelled.
    void
    setCancelled(boolean cancelled)
    Sets whether the event is cancelled.
    void
    setPlayerHead(org.bukkit.inventory.ItemStack playerHead)
    Sets the ItemStack to drop as the player's head.

    Methods inherited from class net.mathias2246.buildmc.api.event.CustomEvent

    getMetadata, putMetadata, removeMetadata

    Methods inherited from class org.bukkit.event.Event

    getEventName, isAsynchronous

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PlayerHeadDropEvent

      public PlayerHeadDropEvent(org.bukkit.entity.Player victim, org.bukkit.entity.Player killer, org.bukkit.inventory.ItemStack playerHead, org.bukkit.event.entity.PlayerDeathEvent event)
      Constructs a new PlayerHeadDropEvent.
      Parameters:
      victim - the player who died (the owner of the head)
      killer - the player who killed the victim, may be null
      playerHead - the ItemStack representing the victim's head
  • Method Details

    • getVictim

      public org.bukkit.entity.Player getVictim()
      Gets the victim whose head is being dropped.
      Returns:
      the victim player
    • getKiller

      public org.bukkit.entity.Player getKiller()
      Gets the killer of the victim.
      Returns:
      the killer player, or null if the death was not caused by another player
    • getPlayerHead

      public org.bukkit.inventory.ItemStack getPlayerHead()
      Gets the ItemStack representing the player's head.
      Returns:
      the head item
    • setPlayerHead

      public void setPlayerHead(org.bukkit.inventory.ItemStack playerHead)
      Sets the ItemStack to drop as the player's head.
      Parameters:
      playerHead - the new head item
    • getEvent

      public org.bukkit.event.entity.PlayerDeathEvent getEvent()
      Gets the PlayerDeathEvent that caused the head to drop.
      Returns:
      the head item
    • isCancelled

      public boolean isCancelled()
      Checks whether the event has been cancelled.
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
      Returns:
      true if cancelled, false otherwise
    • setCancelled

      public void setCancelled(boolean cancelled)
      Sets whether the event is cancelled.
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
      Parameters:
      cancelled - true to cancel the event, false to allow it
    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Gets the list of handlers for this event instance.
      Specified by:
      getHandlers in class CustomEvent
      Returns:
      the handler list
    • getHandlerList

      public static org.bukkit.event.HandlerList getHandlerList()
      Gets the static list of handlers for this event type. Required by Bukkit for event registration.
      Returns:
      the handler list