001 package org.bukkit.event.inventory; 002 003 import org.bukkit.event.inventory.InventoryType.SlotType; 004 import org.bukkit.inventory.CraftingInventory; 005 import org.bukkit.inventory.InventoryView; 006 import org.bukkit.inventory.Recipe; 007 008 /** 009 * Called when the recipe of an Item is completed inside a crafting matrix. 010 */ 011 public class CraftItemEvent extends InventoryClickEvent { 012 private Recipe recipe; 013 014 @Deprecated 015 public CraftItemEvent(Recipe recipe, InventoryView what, SlotType type, int slot, boolean right, boolean shift) { 016 this(recipe, what, type, slot, right ? (shift ? ClickType.SHIFT_RIGHT : ClickType.RIGHT) : (shift ? ClickType.SHIFT_LEFT : ClickType.LEFT), InventoryAction.PICKUP_ALL); 017 } 018 019 public CraftItemEvent(Recipe recipe, InventoryView what, SlotType type, int slot, ClickType click, InventoryAction action) { 020 super(what, type, slot, click, action); 021 this.recipe = recipe; 022 } 023 024 public CraftItemEvent(Recipe recipe, InventoryView what, SlotType type, int slot, ClickType click, InventoryAction action, int key) { 025 super(what, type, slot, click, action, key); 026 this.recipe = recipe; 027 } 028 029 /** 030 * @return A copy of the current recipe on the crafting matrix. 031 */ 032 public Recipe getRecipe() { 033 return recipe; 034 } 035 036 @Override 037 public CraftingInventory getInventory() { 038 return (CraftingInventory) super.getInventory(); 039 } 040 }