Class 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
    • 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 interface DropHeadEvent
        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 interface DropHeadEvent
        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
      • 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 interface Cancellable
        Returns:
        Whether the event has been cancelled.
      • setCancelled

        public void setCancelled​(boolean cancel)
        Sets whether the event should be cancelled.
        Specified by:
        setCancelled in interface Cancellable
        Parameters:
        cancel - whether the event should be cancelled.
      • getHandlers

        public HandlerList getHandlers()
        Get a list of handlers for the event.
        Specified by:
        getHandlers in class Event
        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