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
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
ItemStackrepresenting the head - Attach metadata for other plugins to consume
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
ConstructorsConstructorDescriptionPlayerHeadDropEvent(org.bukkit.entity.Player victim, org.bukkit.entity.Player killer, org.bukkit.inventory.ItemStack playerHead, org.bukkit.event.entity.PlayerDeathEvent event) Constructs a newPlayerHeadDropEvent. -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.event.entity.PlayerDeathEventgetEvent()Gets thePlayerDeathEventthat caused the head to drop.static org.bukkit.event.HandlerListGets the static list of handlers for this event type.@NotNull org.bukkit.event.HandlerListGets the list of handlers for this event instance.org.bukkit.entity.PlayerGets the killer of the victim.org.bukkit.inventory.ItemStackGets theItemStackrepresenting the player's head.org.bukkit.entity.PlayerGets the victim whose head is being dropped.booleanChecks whether the event has been cancelled.voidsetCancelled(boolean cancelled) Sets whether the event is cancelled.voidsetPlayerHead(org.bukkit.inventory.ItemStack playerHead) Sets theItemStackto drop as the player's head.Methods inherited from class net.mathias2246.buildmc.api.event.CustomEvent
getMetadata, putMetadata, removeMetadataMethods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
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 newPlayerHeadDropEvent.- Parameters:
victim- the player who died (the owner of the head)killer- the player who killed the victim, may benullplayerHead- theItemStackrepresenting 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
nullif the death was not caused by another player
-
getPlayerHead
public org.bukkit.inventory.ItemStack getPlayerHead()Gets theItemStackrepresenting the player's head.- Returns:
- the head item
-
setPlayerHead
public void setPlayerHead(org.bukkit.inventory.ItemStack playerHead) Sets theItemStackto drop as the player's head.- Parameters:
playerHead- the new head item
-
getEvent
public org.bukkit.event.entity.PlayerDeathEvent getEvent()Gets thePlayerDeathEventthat caused the head to drop.- Returns:
- the head item
-
isCancelled
public boolean isCancelled()Checks whether the event has been cancelled.- Specified by:
isCancelledin interfaceorg.bukkit.event.Cancellable- Returns:
- true if cancelled, false otherwise
-
setCancelled
public void setCancelled(boolean cancelled) Sets whether the event is cancelled.- Specified by:
setCancelledin interfaceorg.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:
getHandlersin classCustomEvent- 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
-