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

Close player inventory?

Comments in 'Plugin Development' started by Legoboy0215, Aug 11, 2016.

  1. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Is it possible to do this? I see functions like BaseInventory::close($who) and Player::removeWindow($inv)
    but I see it is after PM receives the packets. Are there any ways to close the inventory window so the client doesn't see his own inventory any more?

    tl;dr: Is there anyway to close the client inv window?
  2. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    $playerInventory->close($player);
    This is what I see on the source code, not tested.
  3. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Nope, ig doesnt work.
  4. Extreme_Heat
    Offline

    Extreme_Heat Active Member

    Joined:
    Apr 19, 2016
    Posts:
    76
    Minecraft User:
    Extreme_Heat
    Try:

    PHP:
    $packet = new \pocketmine\network\protocol\ContainerClosePacket();
    $packet->windowid 0;
    $player->dataPacket($packet);
    Skullex and Legoboy0215 like this.

Share This Page

Advertisement