I currently have the following setup:

  1. Player opens a GUI via the /gui command The inventory opens with some generated ItemStacks (Banner)
  2. Player clicks on the banners and they get added to their inventory via player.addItemStackToInventory()
  3. Player closes the GUI when done
  4. The player now seems to have the items in their inventory, but when you try to interact with them the inventory gets "updated" and the added Items vanish.

Why does this happen and how can I prevent it?

The code can be found here.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.