pocketmine\inventory\BaseInventory::onOpen PHP Method

onOpen() public method

public onOpen ( Player $who )
$who pocketmine\Player
    public function onOpen(Player $who)
    {
        $this->viewers[spl_object_hash($who)] = $who;
    }

Usage Example

Ejemplo n.º 1
0
 public function onOpen(Player $who)
 {
     parent::onOpen($who);
     $pk = new ContainerOpenPacket();
     $pk->windowid = $who->getWindowId($this);
     $pk->type = $this->getType()->getNetworkType();
     $pk->slots = $this->getSize();
     if ($this->holder instanceof Vector3) {
         $pk->x = $this->holder->getX();
         $pk->y = $this->holder->getY();
         $pk->z = $this->holder->getZ();
     } else {
         $pk->x = $pk->y = $pk->z = 0;
     }
     $who->dataPacket($pk);
     $this->sendContents($who);
 }
All Usage Examples Of pocketmine\inventory\BaseInventory::onOpen