public static function sendCommand($command) { if (self::$connection == null) { self::$connection = stream_socket_client("tcp://127.0.0.1:8989", $errno, $errorMessage); if (self::$connection === false) { throw new UnexpectedValueException("Failed to connect: {$errorMessage}"); } } fwrite(self::$connection, $command); }
public function withdrawExp($amount, $reason) { DataServer::withdrawExpAndMoney($this->username, $amount, 0, $reason); }