public function close(Player $player, $reason = "unknown reason") { if (isset($this->sessions[$player])) { $identifier = $this->sessions[$player]; $this->sessions->detach($player); unset($this->sessionsPlayers[$identifier]); $player->close(TextFormat::YELLOW . $player->getName() . " has left the game", "Connection closed"); } else { return; } $this->thread->pushMainToThreadPacket(chr(ServerManager::PACKET_CLOSE_SESSION) . Binary::writeInt($identifier)); }
public function close(Player $player, $reason = "unknown reason") { if (isset($this->sessions[$player])) { $identifier = $this->sessions[$player]; $this->sessions->detach($player); unset($this->identifiers[$identifier]); $this->thread->pushMainToThreadPacket(chr(ServerManager::PACKET_CLOSE_SESSION) . Binary::writeInt($identifier)); } else { return; } }