ItemCraft Event

Hello.
How I Can track if user crafted the item?
Trying to do smth like:

@Listener
public void onItemCraft(ClickInventoryEvent event, @Root Player player, @Getter(“getTargetInventory”) Inventory inventory) {

if (inventory.getArchetype() == InventoryArchetypes.PLAYER || inventory.getArchetype() == InventoryArchetypes.WORKBENCH) {

    Inventory craftingOutputs = inventory.query(CraftingOutput.class);

    craftingOutputs.slots().forEach(slot -> slot.peek().ifPresent(itemStack -> {
        String itemId = itemStack.getItem().getType().getId();
            Utils.Utils.sendMessage(player, "Вы скрафтили: [", TextColors.BLUE, itemId, "]");
    }));
}

But, have a problem, player get message after compile items at workbench to create smth.

How to check if user click on crafting output field?

Check the transactions in event.getTransactions() - for each one, check if its slot is a CraftingOutput.

So, how I can do it?
Please help

… what?
Are you asking how to call a method?

Yep, sorry, but I’m so dumb for this…

            if(event.getTransactions().equals(craftingOutputs)){
                Utils.Utils.sendMessage(player, "Вы скрафтили: [", TextColors.BLUE, itemId, "]");    
            }

This code doesn’t work

Now trying do this:

Inventory craftingOutputs = inventory.query(CraftingOutput.class);

        craftingOutputs.slots().forEach(slot -> slot.peek().ifPresent(itemStack -> {
            String itemId = itemStack.getItem().getType().getId();
                for (Iterator<SlotTransaction> i = event.getTransactions().iterator(); i.hasNext();) {
                    SlotTransaction item = i.next();
                    if(item.getSlot().equals(slot)){
                        Utils.Utils.sendMessage(player, "Вы скрафтили: [", TextColors.BLUE, itemId, "]");   
                    }
                }
               
        }));

Not success, again

The main question is - how I Can get the craftring output slot?

In the line Inventory craftingOutputs = inventory.query(CraftingOutput.class);, replace Inventory craftingOutputs with CraftingOutput slot. This is the crafting output slot. You don’t need to use slots() with this.