Solved Event when player takes crafted item

Discussion in 'Spigot Plugin Development' started by torpkev, Apr 14, 2020.

  1. I'm assigning a PersistentDataContainer to an item and saving the key in a list (and outputting a data file), so only want to do that when they actually grab the item off the crafting table rather than just when a recipe is successfully laid out.

    I know that PrepareItemCraftEvent will fire as I add things to the crafting table, and CraftItem will fire when a valid item is created.

    Not sure what Event I can catch when the player actually takes the item.

    Can anyone point me in the right direction?

    Thanks
     
  2. Code (Java):
    @EventHandler
        public void craft(CraftItemEvent e) {
           
            e.getInventory();
           
            e.getRecipe();
           
            e.getAction();
           
            e.getInventory().getHolder();
        }
     
  3. Or you can detect InventoryType on click listener
     
  4. Thanks - Thought there might be an actual CraftItemTaken event or some such that I was missing.

    I'm using InventoryClick and capturing slot 0 on my check.

    Appreciate it!
     
  5. YW
     
    • Like Like x 1