Get the sum of a specific item in players inventory on PlayerItemHeldEvent

Discussion in 'Plugin Development' started by j5on, Jul 1, 2022.

Thread Status:
Not open for further replies.
  1. Offline

    j5on

    I want to get the amount of items in player inventory and delete every item except 10
    for example: player has 3 golden apples with quantity of 15 in 3 slots each and I want to leave the player with 1 golden apple with quantity of 10 in 1 slot
     
  2. Offline

    BlueBottle9

    I think this is way to solve this.
    Code:
    for (ItemStack item:player.getInventory()){
                       //do something with the item
    }
     
    bennie3211 likes this.
Thread Status:
Not open for further replies.

Share This Page