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
ConstructorsConstructorDescriptionRecipeAccessCheckEvent(@NotNull ZentrixRecipe recipe, @Nullable org.bukkit.entity.Player player, @Nullable org.bukkit.World world) -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull org.bukkit.event.HandlerList@NotNull org.bukkit.event.HandlerListGets the handler list for this event.@NotNull Optional<org.bukkit.entity.Player> The crafting player; empty when a block cooks on its own.@NotNull ZentrixRecipeThe custom recipe.@NotNull Optional<org.bukkit.World> getWorld()The world the recipe is made in, when known.booleanWhether a listener refused the recipe.voidsetCancelled(boolean cancelled) Refuses the recipe this time.Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
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
The custom recipe. -
getPlayer
The crafting player; empty when a block cooks on its own. -
getWorld
The world the recipe is made in, when known. -
isCancelled
public boolean isCancelled()Whether a listener refused the recipe.- Specified by:
isCancelledin interfaceorg.bukkit.event.Cancellable
-
setCancelled
public void setCancelled(boolean cancelled) Refuses the recipe this time.- Specified by:
setCancelledin interfaceorg.bukkit.event.Cancellable
-
getHandlers
@NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()Description copied from class:ZentrixEventGets the handler list for this event.- Overrides:
getHandlersin classZentrixEvent- Returns:
- The handler list
-
getHandlerList
@NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList()
-