Class CauldronIngredientAddEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.block.BlockEvent
wtf.choco.alchema.api.event.CauldronEvent
wtf.choco.alchema.api.event.CauldronIngredientAddEvent

public class CauldronIngredientAddEvent
extends CauldronEvent
Called when an Item consumed by an AlchemicalCauldron and an ingredient is added to the cauldron.

By default, a CauldronIngredientItemStack is added. This event should be used to change the implementation inserted into the cauldron for more accurate recipe calculation.

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
    CauldronIngredientAddEvent​(@NotNull AlchemicalCauldron cauldron, @NotNull CauldronIngredient ingredient, @NotNull org.bukkit.entity.Item item)
  • Method Summary

    Modifier and Type Method Description
    static @NotNull org.bukkit.event.HandlerList getHandlerList()
    Get the HandlerList instance for this event.
    @NotNull org.bukkit.event.HandlerList getHandlers()  
    @NotNull CauldronIngredient getIngredient()
    Get the CauldronIngredient implementation to be added to the cauldron.
    @NotNull org.bukkit.entity.Item getItem()
    Get the Item that was thrown into the cauldron to cause this event.
    @NotNull org.bukkit.inventory.ItemStack getItemStack()
    Get the ItemStack that was thrown into the cauldron to cause this event.
    @Nullable org.bukkit.OfflinePlayer getPlayer()
    Get the player that threw the Item into the cauldron to cause this event (if there is one).
    @Nullable java.util.UUID getPlayerUUID()
    Get the UUID of the player that threw the Item into the cauldron to cause this event (if there is one).
    void setIngredient​(@NotNull CauldronIngredient ingredient)
    Set the CauldronIngredient implementation to be added to the cauldron.

    Methods inherited from class wtf.choco.alchema.api.event.CauldronEvent

    getCauldron

    Methods inherited from class org.bukkit.event.block.BlockEvent

    getBlock

    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

    • CauldronIngredientAddEvent

      public CauldronIngredientAddEvent​(@NotNull @NotNull AlchemicalCauldron cauldron, @NotNull @NotNull CauldronIngredient ingredient, @NotNull @NotNull org.bukkit.entity.Item item)
      Parameters:
      cauldron - the cauldron that caused the craft
      ingredient - the ingredient to be added to the cauldron
      item - the item thrown into the cauldron
  • Method Details

    • setIngredient

      public void setIngredient​(@NotNull @NotNull CauldronIngredient ingredient)
      Set the CauldronIngredient implementation to be added to the cauldron.

      By default, a CauldronIngredientItemStack is added to an AlchemicalCauldron when an Item is dropped inside. This method should be used to change the implementation inserted into the cauldron for more accurate recipe calculation.

      Parameters:
      ingredient - the ingredient to set
    • getIngredient

      @NotNull public @NotNull CauldronIngredient getIngredient()
      Get the CauldronIngredient implementation to be added to the cauldron.
      Returns:
      the ingredient
    • getItem

      @NotNull public @NotNull org.bukkit.entity.Item getItem()
      Get the Item that was thrown into the cauldron to cause this event.

      NOTE: The item returned by this method will be destroyed by implementation after all event listeners have been called upon. Therefore it is best not to rely on the validity of the Item entity returned by this method.

      Returns:
      the item
    • getItemStack

      @NotNull public @NotNull org.bukkit.inventory.ItemStack getItemStack()
      Get the ItemStack that was thrown into the cauldron to cause this event. This is a convenience method and is equivalent to getItem().getItemStack().
      Returns:
      the item stack
    • getPlayerUUID

      @Nullable public @Nullable java.util.UUID getPlayerUUID()
      Get the UUID of the player that threw the Item into the cauldron to cause this event (if there is one).
      Returns:
      the thrower UUID. null if none
    • getPlayer

      @Nullable public @Nullable org.bukkit.OfflinePlayer getPlayer()
      Get the player that threw the Item into the cauldron to cause this event (if there is one).
      Returns:
      the thrower. null if none
    • 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