Class RecipeAccessCheckEvent

java.lang.Object
org.bukkit.event.Event
dev.itsharshxd.zentrix.api.events.ZentrixEvent
dev.itsharshxd.zentrix.api.events.recipe.RecipeAccessCheckEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public final class RecipeAccessCheckEvent extends ZentrixEvent implements org.bukkit.event.Cancellable
Called when Zentrix is about to allow a custom recipe: a player preparing it in a crafting grid or at a stonecutter, or a furnace, smoker or campfire about to cook it.

This is an additional access policy. It only fires once Zentrix's own rules - disabled phases and game types, one-time use and craft limits - have allowed the recipe; cancel it to refuse the recipe this time, and it behaves as if it did not exist: nothing is shown, said or cooked. A listener cannot allow a recipe Zentrix refused.

It is asked often - a lit furnace asks on every cooking tick - so listeners must be cheap. Main thread; only fired while a listener is registered.

Since:
1.8.0
  • Nested Class Summary

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

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

    Constructors
    Constructor
    Description
    RecipeAccessCheckEvent(@NotNull ZentrixRecipe recipe, @Nullable org.bukkit.entity.Player player, @Nullable org.bukkit.World world)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static @NotNull org.bukkit.event.HandlerList
     
    @NotNull org.bukkit.event.HandlerList
    Gets the handler list for this event.
    @NotNull Optional<org.bukkit.entity.Player>
    The crafting player; empty when a block cooks on its own.
    @NotNull ZentrixRecipe
    The custom recipe.
    @NotNull Optional<org.bukkit.World>
    The world the recipe is made in, when known.
    boolean
    Whether a listener refused the recipe.
    void
    setCancelled(boolean cancelled)
    Refuses the recipe this time.

    Methods inherited from class org.bukkit.event.Event

    callEvent, getEventName, isAsynchronous

    Methods inherited from class java.lang.Object

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

    • RecipeAccessCheckEvent

      public RecipeAccessCheckEvent(@NotNull @NotNull ZentrixRecipe recipe, @Nullable @Nullable org.bukkit.entity.Player player, @Nullable @Nullable org.bukkit.World world)
  • Method Details

    • getRecipe

      @NotNull public @NotNull ZentrixRecipe getRecipe()
      The custom recipe.
    • getPlayer

      @NotNull public @NotNull Optional<org.bukkit.entity.Player> getPlayer()
      The crafting player; empty when a block cooks on its own.
    • getWorld

      @NotNull public @NotNull Optional<org.bukkit.World> getWorld()
      The world the recipe is made in, when known.
    • isCancelled

      public boolean isCancelled()
      Whether a listener refused the recipe.
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
    • setCancelled

      public void setCancelled(boolean cancelled)
      Refuses the recipe this time.
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Description copied from class: ZentrixEvent
      Gets the handler list for this event.
      Overrides:
      getHandlers in class ZentrixEvent
      Returns:
      The handler list
    • getHandlerList

      @NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList()