Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

remove 1 item from inventory

Comments in 'Plugin Development' started by BalAnce, Jul 7, 2015.

  1. BalAnce
    Offline

    BalAnce Active Member

    Joined:
    Mar 10, 2015
    Posts:
    125
    Minecraft User:
    BalAnce
    How do i remove 1 item from inventory cause i use the code below and it removes all the item no just 1 of it.
    PHP:
    $i Item::get(34101);
    $player->getInventory()->remove($i);
  2. Asidert
    Offline

    Asidert Active Member Plugin Developer

    Joined:
    Oct 21, 2014
    Posts:
    123
    Plugins:
    1
    Minecraft User:
    Asidert
    Your code don't work, because you should use removeItem()!
    Example:
    PHP:
    $player->getInventory()->removeItem($i);
    Taha_The_Hacker, BalAnce and iksaku like this.
  3. BalAnce
    Offline

    BalAnce Active Member

    Joined:
    Mar 10, 2015
    Posts:
    125
    Minecraft User:
    BalAnce
    Cool it worked thanks!
  4. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    PHP:
    $event->getPlayer()->getInvenTory()->removeItem(Item::Get(1,0,64));
    //add Item
    $event->getPlayer()->getInvenTory()->addItem(item::get(1,0,64));
    Last edited: Nov 5, 2015
  5. GmWM
    Offline

    GmWM Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    181
    Plugins:
    3
    addItem(); * :)
  6. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    OK
  7. BalAnce
    Offline

    BalAnce Active Member

    Joined:
    Mar 10, 2015
    Posts:
    125
    Minecraft User:
    BalAnce
    this is super old.... :confused:
    Taha_The_Hacker likes this.

Share This Page

Advertisement