@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
public void onInventoryCraft(InventoryClickEvent e) {
if (!(e instanceof CraftItemEvent))
return;
CraftItemEvent event = (CraftItemEvent) e;
// make sure plugin is enabled
if(!plugin.isEnabled()) return;
// If event is nothing or place, do nothing
switch (event.getAction()) {
case NOTHING:
case PLACE_ONE:
case PLACE_ALL:
case PLACE_SOME:
return;
default:
break;
}
if (event.getAction() == InventoryAction.NOTHING)
return;
CraftingInventory inv = event.getInventory();
if (!(inv instanceof CraftingInventory) || !event.getSlotType().equals(SlotType.RESULT))
return;
Recipe recipe = event.getRecipe();
if (recipe == null)
return;
if (!(event.getWhoClicked() instanceof Player))
return;
Player player = (Player) event.getWhoClicked();
ItemStack resultStack = recipe.getResult();
if (resultStack == null)
return;