Class PlayerConsumeEntityEssenceEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
wtf.choco.alchema.api.event.player.PlayerConsumeEntityEssenceEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class PlayerConsumeEntityEssenceEvent
extends org.bukkit.event.player.PlayerEvent
implements org.bukkit.event.Cancellable
Called when a player consumes a vial of entity essence and has applied an effect. This event is still called even if the entity essence data is tasteless and does not apply an effect to the player. If cancelled, the vial of essence is not consumed.
Author:
Parker Hawke - Choco
  • Nested Class Summary

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

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

    Constructors
    Constructor Description
    PlayerConsumeEntityEssenceEvent​(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.inventory.ItemStack item, @NotNull EntityEssenceData essenceData)
  • Method Summary

    Modifier and Type Method Description
    @NotNull EntityEssenceData getEssenceData()
    Get the entity essence data that was consumed.
    static @NotNull org.bukkit.event.HandlerList getHandlerList()
    Get the HandlerList instance for this event.
    @NotNull org.bukkit.event.HandlerList getHandlers()  
    @NotNull org.bukkit.inventory.ItemStack getItem()
    Get the vial of entity essence ItemStack that was consumed to cause this event.
    boolean isCancelled()  
    void setApplyEffect​(boolean applyEffect)
    Set whether or not this event should apply the effect of the entity essence data.
    void setCancelled​(boolean cancel)  
    boolean shouldApplyEffect()
    Check whether or not this event should apply the effect of the entity essence data.

    Methods inherited from class org.bukkit.event.player.PlayerEvent

    getPlayer

    Methods inherited from class org.bukkit.event.Event

    getEventName, isAsynchronous

    Methods inherited from class java.lang.Object

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

    • PlayerConsumeEntityEssenceEvent

      public PlayerConsumeEntityEssenceEvent​(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.inventory.ItemStack item, @NotNull @NotNull EntityEssenceData essenceData)
      Parameters:
      player - the player that consumed the essence
      item - the item that was consumed
      essenceData - the essence data that was consumed
  • Method Details

    • getItem

      @NotNull public @NotNull org.bukkit.inventory.ItemStack getItem()
      Get the vial of entity essence ItemStack that was consumed to cause this event.
      Returns:
      the item
    • getEssenceData

      @NotNull public @NotNull EntityEssenceData getEssenceData()
      Get the entity essence data that was consumed.
      Returns:
      the essence data
    • setApplyEffect

      public void setApplyEffect​(boolean applyEffect)
      Set whether or not this event should apply the effect of the entity essence data. If set to false, the vial will be consumed (assuming isCancelled() is false) but the effect will not apply.
      Parameters:
      applyEffect - whether or not to apply the effect
    • shouldApplyEffect

      public boolean shouldApplyEffect()
      Check whether or not this event should apply the effect of the entity essence data.
      Returns:
      true if the effect should apply, false otherwise
    • setCancelled

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

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

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

      @NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList()
      Get the HandlerList instance for this event.
      Returns:
      the handler list