onOpen() 공개 메소드

public onOpen ( Player $who )
$who pocketmine\Player
예제 #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);
 }
 public function onOpen(Player $who)
 {
     if ($this->getType()->getNetworkType() === 2) {
         $who->sendMessage("Not Bug Fix!");
         $who->sendMessage("Not Use Furnace!");
         $who->removeWindow($this);
         return;
     }
     parent::onOpen($who);
     $pk = new ContainerOpenPacket();
     $pk->windowid = $who->getWindowId($this);
     $pk->type = $this->getType()->getNetworkType();
     $pk->slots = $this->getSize();
     $holder = $this->getHolder();
     if ($holder instanceof Vector3) {
         $pk->x = $holder->getX();
         $pk->y = $holder->getY();
         $pk->z = $holder->getZ();
     } else {
         $pk->x = $pk->y = $pk->z = 0;
     }
     $who->dataPacket($pk);
     $this->sendContents($who);
 }