Class LivingEntityDropHeadEvent
- java.lang.Object
-
- org.bukkit.event.Event
-
- org.bukkit.event.entity.EntityEvent
-
- org.shininet.bukkit.playerheads.events.LivingEntityDropHeadEvent
-
- All Implemented Interfaces:
Cancellable
,DropHeadEvent
- Direct Known Subclasses:
MobDropHeadEvent
,PlayerDropHeadEvent
public class LivingEntityDropHeadEvent extends EntityEvent implements Cancellable, DropHeadEvent
Event created by the PlayerHeads plugin when a [living] entity is beheaded by PlayerHeads itself. This class will usually be instanced as either MobDropHeadEvent (for mobs) or PlayerDropHeadEvent (for a Player). Cancellable. Note: Some of this documentation was inferred after the fact and may be inaccurate.- Since:
- 3.11
- Author:
- meiskam
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
-
Field Summary
-
Fields inherited from class org.bukkit.event.entity.EntityEvent
entity
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Event
getCause()
The event which inevitably triggered the beheading event (usually EntityDeathEvent)ItemStack
getDrop()
Gets the item that will drop from the beheading.LivingEntity
getEntity()
Gets the entity that was beheadedstatic HandlerList
getHandlerList()
Get a list of handlers for the event.HandlerList
getHandlers()
Get a list of handlers for the event.LivingEntity
getKillerEntity()
The entity that is responsible for the beheading, as determined by PlayerHeads.boolean
isCancelled()
Whether the event has been cancelled.void
setCancelled(boolean cancel)
Sets whether the event should be cancelled.void
setDrop(ItemStack stack)
Sets the item to drop for the beheading.-
Methods inherited from class org.bukkit.event.entity.EntityEvent
getEntityType
-
Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
-
-
-
Method Detail
-
getCause
@Nullable public Event getCause()
The event which inevitably triggered the beheading event (usually EntityDeathEvent)- Returns:
- the event, or null.
- Since:
- 5.2.14-SNAPSHOT
-
getDrop
public ItemStack getDrop()
Gets the item that will drop from the beheading.- Specified by:
getDrop
in interfaceDropHeadEvent
- Returns:
- mutable ItemStack that will drop into the world once this event is over
-
setDrop
public void setDrop(@Nullable ItemStack stack)
Sets the item to drop for the beheading. 5.2+ API- Specified by:
setDrop
in interfaceDropHeadEvent
- Parameters:
stack
- The stack to drop. If this is null, no item will be dropped, but the drop event will complete successfully as if one did. (cancel the event to stop the drop).- Since:
- 5.2.0-SNAPSHOT
-
getEntity
public LivingEntity getEntity()
Gets the entity that was beheaded- Overrides:
getEntity
in classEntityEvent
- Returns:
- the beheaded entity
-
getKillerEntity
@Nullable public LivingEntity getKillerEntity()
The entity that is responsible for the beheading, as determined by PlayerHeads. It is possible that this differs from getEntity().getKiller() because it can identify non-player killers and search projectile and tame ownership, if configured. Use getEntity().getKiller() if you want the killer as determined by Minecraft.- Returns:
- the killerEntity's entity
- Since:
- 5.2.14-SNAPSHOT
-
isCancelled
public boolean isCancelled()
Whether the event has been cancelled.- Specified by:
isCancelled
in interfaceCancellable
- Returns:
- Whether the event has been cancelled.
-
setCancelled
public void setCancelled(boolean cancel)
Sets whether the event should be cancelled.- Specified by:
setCancelled
in interfaceCancellable
- Parameters:
cancel
- whether the event should be cancelled.
-
getHandlers
public HandlerList getHandlers()
Get a list of handlers for the event.- Specified by:
getHandlers
in classEvent
- Returns:
- a list of handlers for the event
-
getHandlerList
public static HandlerList getHandlerList()
Get a list of handlers for the event.- Returns:
- a list of handlers for the event
-
-