Interface PlayerPrepareCraftEvent

All Superinterfaces:
Event, PlayerEvent

public interface PlayerPrepareCraftEvent extends PlayerEvent
Fired each time the crafting grid of a player changes, once the server has looked for a matching recipe and before the result slot is shown.

Setting the result to ItemStack.EMPTY hides it, so the craft cannot happen. Setting another item shows that one instead; the ingredients taken stay those of the match.

Since:
0.1.0
  • Method Details

    • input

      CraftingInput input()
      Returns the crafting grid.
      Returns:
      the crafting grid
      Since:
      0.1.0
    • match

      Returns the recipe found, null when none matches.
      Returns:
      the recipe found, null when none matches
      Since:
      0.1.0
    • result

      ItemStack result()
      Returns what the result slot shows, ItemStack.EMPTY for nothing.
      Returns:
      what the result slot shows, ItemStack.EMPTY for nothing
      Since:
      0.1.0
    • setResult

      void setResult(ItemStack result)
      Changes what the result slot shows. Ignored when no recipe matches: there would be nothing to take from the grid.
      Parameters:
      result - the item to show, ItemStack.EMPTY to block the craft
      Since:
      0.1.0