/** * Reads info from respond packet. * * <p> * Note: Since 0.2.0+SVN this field is protected instead of private. * </p> * * @version 0.2.0+SVN * @since 0.1.4 * @param OTS_Buffer $info Information packet. */ public function __construct(OTS_Buffer $info) { // skips packet length $info->getShort(); while ($info->isValid()) { switch ($info->getChar()) { case self::RESPOND_BASIC_SERVER_INFO: $this->name = $info->getString(); $this->ip = $info->getString(); $this->port = (int) $info->getString(); break; case self::RESPOND_OWNER_SERVER_INFO: $this->owner = $info->getString(); $this->eMail = $info->getString(); break; case self::RESPOND_MISC_SERVER_INFO: $this->motd = $info->getString(); $this->location = $info->getString(); $this->url = $info->getString(); $this->uptime = $info->getLong() << 32; $this->uptime += $info->getLong(); break; case self::RESPOND_PLAYERS_INFO: $this->online = $info->getLong(); $this->max = $info->getLong(); $this->peak = $info->getLong(); break; case self::RESPOND_MAP_INFO: $this->map = $info->getString(); $this->author = $info->getString(); $this->width = $info->getShort(); $this->height = $info->getShort(); break; case self::RESPOND_EXT_PLAYERS_INFO: $count = $info->getLong(); for ($i = 0; $i < $count; $i++) { $name = $info->getString(); $this->players[$name] = $info->getLong(); } break; case self::RESPOND_SERVER_SOFTWARE_INFORMATION: $this->serverType = $info->getString(); $this->serverVersion = $info->getString(); $this->clientVersion = $info->getString(); break; } } }