ClickInventoryEvent/Inventory api help

so for my plugin i’m making, i’m using the ClickInventoryEvent and i want the player to be able to click on an ItemStack in their inventory and it will add it to a list, then clicking again will remove it. The closest i’ve gotten to getting it to work is with this code InventoryListener.java · GitHub. With that it only works if there isn’t another ItemStack of the same type in inventory. I want it to be able to work with multiple ItemStacks but different slots but am unsure atm how i would go about doing this.

I think this is because you’re using equals to compare the two items. This will only check if the two objects are the same - remember that Sponge usually copies objects in the API, so you’re never guaranteed that the snapshot you added to the list will be the snapshot you’re given in the event.

You’ll want to create 2 ItemStack and use ItemStackComparators instead to compare some or all of the item’s data.

That doesn’t seem to be working either, after doing some research i think i’ll want to use SlotPos, although i’m not sure as to how i would go about getting the SlotPos from the event and from looking things up i found that Inventory2D uses SlotPos but whenever i tried to query for it from a player inventory i just got a ClassCastException. I have a feeling i’m either really messing something up or it’s just not possible with the inventory api atm.

I don’t think the inventory API has been fully implemented as of yet.

Yea you’re right, i was discussing it in irc earlier and they said the same thing

Edit: nvm after i had to afk to work on other things they had talked more about it and i think i might have what i need