Solved Add player on player list

Discussion in 'Development' started by sup, Dec 7, 2019.

  1. sup

    sup Spider

    Messages:
    12
    Hi, before the update of Pocketmine to 1.13 I was using this to ReAdd players on the players list;
    $entry = new PlayerListEntry();
    $entry->uuid = $sender->getUniqueId();
    $entry->entityUniqueId = $sender->getId();
    $entry->xboxUserId = $sender->getXuid();
    $entry->username = $sender->getName();
    $entry->skin = $sender->getSkin();
    $pk = new PlayerListPacket();
    $pk->entries[] = $entry;
    $pk->type = PlayerListPacket::TYPE_ADD;
    foreach($this->getServer()->getOnlinePlayers() as $players){

    $players->sendDataPacket($pk);
    But now when I try to ReAdd the player I crash and this appear in the console;

    [Server thread/CRITICAL]: TypeError: "Argument 1 passed to pocketmine\network\mcpe\NetworkBinaryStream::putSkin() must be an instance of pocketmine\network\mcpe\protocol\types\SkinData, null given, called in phar://C:/Users/coude/OneDrive/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/network/mcpe/protocol/PlayerListPacket.php on line 85" (EXCEPTION) in "src/pocketmine/network/mcpe/NetworkBinaryStream" at line 106

    I tried a lot of things to fix this and it's just not working
     
  2. dktapps

    dktapps Administrator Staff Member PMMP Team

    Messages:
    766
    GitHub:
    dktapps
    don't use packets. There are Server API functions for this.
     
    jasonwynn10 and HimbeersaftLP like this.
  3. sup

    sup Spider

    Messages:
    12
    How can I do that without packets
     
  4. dktapps

    dktapps Administrator Staff Member PMMP Team

    Messages:
    766
    GitHub:
    dktapps
     
    jasonwynn10 likes this.
  5. sup

    sup Spider

    Messages:
    12
    Yes I know butI want to know what server api functions I need to use, can I have an example
     
  6. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,382
    GitHub:
    HimbeersaftLP
    jasonwynn10 likes this.
  7. sup

    sup Spider

    Messages:
    12
    thx worked
     
    HimbeersaftLP likes this.

Share This Page

  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.