Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
CraftItemEvent.java
1 package org.bukkit.event.inventory;
2 
7 
8 /**
9  * Called when the recipe of an Item is completed inside a crafting matrix.
10  */
11 public class CraftItemEvent extends InventoryClickEvent {
12  private Recipe recipe;
13 
14  @Deprecated
15  public CraftItemEvent(Recipe recipe, InventoryView what, SlotType type, int slot, boolean right, boolean shift) {
16  this(recipe, what, type, slot, right ? (shift ? ClickType.SHIFT_RIGHT : ClickType.RIGHT) : (shift ? ClickType.SHIFT_LEFT : ClickType.LEFT), InventoryAction.PICKUP_ALL);
17  }
18 
19  public CraftItemEvent(Recipe recipe, InventoryView what, SlotType type, int slot, ClickType click, InventoryAction action) {
20  super(what, type, slot, click, action);
21  this.recipe = recipe;
22  }
23 
24  public CraftItemEvent(Recipe recipe, InventoryView what, SlotType type, int slot, ClickType click, InventoryAction action, int key) {
25  super(what, type, slot, click, action, key);
26  this.recipe = recipe;
27  }
28 
29  /**
30  * @return A copy of the current recipe on the crafting matrix.
31  */
32  public Recipe getRecipe() {
33  return recipe;
34  }
35 
36  @Override
37  public CraftingInventory getInventory() {
38  return (CraftingInventory) super.getInventory();
39  }
40 }