1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Item add bug

Discussion in 'Development' started by Harviy11, Nov 17, 2016.

  1. Harviy11

    Harviy11 Baby Zombie

    Messages:
    100
    Hello when i use
    PHP:
    $player->getInventory()->setItem(8Item::get(101)->setCustomName(C::GREEN ."Hub"));
    it do not add item to player! only when player break block:( help
     
  2. BalAnce

    BalAnce Silverfish

    Messages:
    22
    GitHub:
    YaBoiBalAnce
    why not?
    PHP:
    $player->getInventory()->addItem(Item::get(1,0,1)->setCustomName(C::GREEN ."Hub"));
     
  3. Harviy11

    Harviy11 Baby Zombie

    Messages:
    100
    i know now why it dont running :D because my server is so laggy when i tested it on server with 4 cpu and 6gb ram i works
     
  4. Jack Noordhuis

    Jack Noordhuis Zombie Pigman Poggit Reviewer

    Messages:
    618
    GitHub:
    JackNoordhuis
    Try Player::getInventory->sendContents($player) if you're still getting this issue. It's probably caused by PlayerInventory::setItem() not sending an inventory update to the client.
     
  5. Harviy11

    Harviy11 Baby Zombie

    Messages:
    100
    No, this dont fix problem. It dont add item because my server is very laggy...
     
  6. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    Then get a better server... ._.
     
  7. Harviy11

    Harviy11 Baby Zombie

    Messages:
    100
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.