Change inventory archetype


When copying inventory, the archetype changes from DOUBLE_CHEST to UNKNOWN.
How would I be able to change that in the Inventory object?

I get the new inventory from the event.getTargetInventory().first(), which returns opened double chest’s inventory, but sets it’s archetype to UNKNOWN.

Kind regards, MGlolenstine


Why are you using .first()? And how are you coping the inventory?


I’m just taking the Inventory that I receive from the above command and store it, and I’m using the Inventory#first() because I believe that it returns the first inventory in the opened “inventory”, in this case first would be the chest’s and the second, next or last would be player’s inventories. Am I wrong in assuming that?


Its not guaranteed. The best idea is to use a Query on the inventory. Take a look at QueryOperationTypes for a guaranteed match.