How to get Inventory Slots

Hey there!

I’m trying to get the index of the inventory slot that is clicked. Here’s the code I’m using:

SlotPos slotPos = event.getTransactions().get(0).getSlot().getProperty(SlotPos.class, event.getTransactions().get(0).getSlot()).get();

It’s telling me that there’s no value present in the Optional that is returned by .getProperty().
I haven’t been able to find any other forum post that has solved this for me.

Any help is appreciated! :smiley: