Beispiel #1
0
 /**
  * Checks player online status.
  * 
  * <p>
  * This method uses binary info protocol.
  * </p>
  * 
  * @param string $name Player name.
  * @return bool True if player is online, false if player or server is online.
  * @throws E_OTS_OutOfBuffer When there is read attemp after end of packet stream.
  * @example examples/server.php info.php
  * @tutorial POT/Server_status.pkg
  */
 public function playerStatus($name)
 {
     // request packet
     $request = new OTS_Buffer();
     $request->putChar(255);
     $request->putChar(1);
     $request->putShort(OTS_ServerStatus::REQUEST_PLAYER_STATUS_INFO);
     $request->putString($name);
     $status = $this->send($request);
     // checks if server is online
     if ($status) {
         $status->getChar();
         return (bool) $status->getChar();
     }
     // offline
     return false;
 }
Beispiel #2
0
 /**
  * Sends COMMAND_SAVE_SERVER command.
  * 
  * <p>
  * Proceeds server save.
  * </p>
  * 
  * @version 0.1.6
  * @since 0.1.6
  * @throws E_OTS_ErrorCode If failure respond received.
  * @throws E_OTS_OutOfBuffer When there is read attemp after end of packet stream.
  */
 public function save()
 {
     // sends message
     $buffer = new OTS_Buffer();
     $buffer->putChar(self::COMMAND_SAVE_SERVER);
     $this->sendCommand($buffer);
 }