|
4 | 4 |
|
5 | 5 | use Webmozart\Assert\Assert; |
6 | 6 | use Pterodactyl\Models\Server; |
| 7 | +use GuzzleHttp\Exception\GuzzleException; |
7 | 8 | use GuzzleHttp\Exception\TransferException; |
8 | 9 | use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; |
9 | 10 |
|
@@ -51,17 +52,17 @@ public function create(array $data): void |
51 | 52 | } |
52 | 53 |
|
53 | 54 | /** |
54 | | - * Updates details about a server on the Daemon. |
| 55 | + * Triggers a server sync on Wings. |
55 | 56 | * |
56 | 57 | * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException |
57 | 58 | */ |
58 | | - public function update(array $data): void |
| 59 | + public function sync(): void |
59 | 60 | { |
60 | 61 | Assert::isInstanceOf($this->server, Server::class); |
61 | 62 |
|
62 | 63 | try { |
63 | | - $this->getHttpClient()->patch('/api/servers/' . $this->server->uuid, ['json' => $data]); |
64 | | - } catch (TransferException $exception) { |
| 64 | + $this->getHttpClient()->post("/api/servers/{$this->server->uuid}/sync"); |
| 65 | + } catch (GuzzleException $exception) { |
65 | 66 | throw new DaemonConnectionException($exception); |
66 | 67 | } |
67 | 68 | } |
@@ -101,26 +102,6 @@ public function reinstall(): void |
101 | 102 | } |
102 | 103 | } |
103 | 104 |
|
104 | | - /** |
105 | | - * By default this function will suspend a server instance on the daemon. However, passing |
106 | | - * "true" as the first argument will unsuspend the server. |
107 | | - * |
108 | | - * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException |
109 | | - */ |
110 | | - public function suspend(bool $unsuspend = false): void |
111 | | - { |
112 | | - Assert::isInstanceOf($this->server, Server::class); |
113 | | - |
114 | | - try { |
115 | | - $this->getHttpClient()->patch( |
116 | | - '/api/servers/' . $this->server->uuid, |
117 | | - ['json' => ['suspended' => !$unsuspend]] |
118 | | - ); |
119 | | - } catch (TransferException $exception) { |
120 | | - throw new DaemonConnectionException($exception); |
121 | | - } |
122 | | - } |
123 | | - |
124 | 105 | /** |
125 | 106 | * Requests the daemon to create a full archive of the server. Once the daemon is finished |
126 | 107 | * they will send a POST request to "/api/remote/servers/{uuid}/archive" with a boolean. |
|
0 commit comments