Add item to a specified slot

Discussion in 'Spigot Plugin Development' started by EskilstunasTs, Oct 10, 2017.

  1. Hi,

    I can't figure out how to add an item to a specified slot.

    I know how to do this with setItem. I have googled it but can't find any answers. Thanks for the help!
     
  2. If you know how to do this with Inventory#setItem(), then why are you asking for help?
     
  3. FrostedSnowman

    Resource Staff

    what r u trying to do that isn't with setItem
     
  4. If you set an item, then it will be just one. This is a command that makes you receive an item. I want to be able to write the commands multiple times to get multiple items. You got me?
     
  5. So you'd like to add onto the current item amount?

    If so, it would just be either:

    A) Player#getItemInHand()
    B) Player#getInventory().getItem(slot)

    Then, clone the item, set the new amount, and apply it to the slot you wish.
     
  6. I want to receive the item to the specified slot lets say I have 0 of the item. And I write the command, then I want the item to be placed in slot number 9
     
    • Like Like x 1