public function onClose(Player $who) { if (count($this->getViewers()) === 1) { $pk = new TileEventPacket(); $pk->x = $this->getHolder()->getX(); $pk->y = $this->getHolder()->getY(); $pk->z = $this->getHolder()->getZ(); $pk->case1 = 1; $pk->case2 = 0; if (($level = $this->getHolder()->getLevel()) instanceof Level) { $level->addChunkPacket($this->getHolder()->getX() >> 4, $this->getHolder()->getZ() >> 4, $pk->setChannel(Network::CHANNEL_WORLD_EVENTS)); } } parent::onClose($who); }
public function onClose(Player $who) { if (count($this->getViewers()) === 1) { $pk = new TileEventPacket(); $pk->x = $this->main->getFakeTile()->x; $pk->y = $this->main->getFakeTile()->y; $pk->z = $this->main->getFakeTile()->z; $pk->case1 = 1; $pk->case2 = 0; if (($level = $this->main->getFakeTile()->getLevel()) instanceof Level) { Server::broadcastPacket($level->getChunkPlayers($this->main->getFakeTile()->x >> 4, $this->main->getFakeTile()->z >> 4), $pk->setChannel(Network::CHANNEL_WORLD_EVENTS)); } } parent::onClose($who); }