Solved Best way on adding or removing ItemStack from Inventory

Discussion in 'Spigot Plugin Development' started by Fliens, Feb 29, 2020.

  1. Hi
    I‘m currently trying to add an ItemStack to an Inventory (Chest). But for the Inventory there is only the addItem() method that adds an Item but not an ItemStack so it ignores for example the amount.

    It would be awesome if there would be a method that tries to add an ItemStack and tells me if this would work or if the inventory is full. And if it is full then it wouldn‘t add any item just tell me that it wasn‘t succesfull
     
  2. SteelPhoenix

    Moderator

    Inventory#addItem(ItemStack...) does not ignore item amount and returns a Map of all items that could not be added.
     
  3. Oh I'm sorry you're absolutely right