diff --git a/app/Http/Controllers/Admin/ServersController.php b/app/Http/Controllers/Admin/ServersController.php index c1105948b..a4e40febb 100644 --- a/app/Http/Controllers/Admin/ServersController.php +++ b/app/Http/Controllers/Admin/ServersController.php @@ -341,8 +341,10 @@ class ServersController extends Controller $server = new ServerRepository; $server->toggleInstall($id); Alert::success('Server status was successfully toggled.')->flash(); - } catch(\Exception $e) { - Log::error($e); + } catch (\Pterodactyl\Exceptions\DisplayException $ex) { + Alert::danger($ex->getMessage())->flash(); + } catch(\Exception $ex) { + Log::error($ex); Alert::danger('An unhandled exception occured while attemping to toggle this servers status.')->flash(); } finally { return redirect()->route('admin.servers.view', [ diff --git a/app/Repositories/ServerRepository.php b/app/Repositories/ServerRepository.php index faa22f1dc..423f78e39 100644 --- a/app/Repositories/ServerRepository.php +++ b/app/Repositories/ServerRepository.php @@ -696,6 +696,9 @@ class ServerRepository public function toggleInstall($id) { $server = Models\Server::findOrFail($id); + if ($server->installed === 2) { + throw new DisplayException('This server was marked as having a failed install, you cannot override this.'); + } $server->installed = ($server->installed === 1) ? 0 : 1; return $server->save(); } diff --git a/resources/views/admin/servers/view.blade.php b/resources/views/admin/servers/view.blade.php index c3c7896b9..6ebdeefb5 100644 --- a/resources/views/admin/servers/view.blade.php +++ b/resources/views/admin/servers/view.blade.php @@ -43,10 +43,14 @@ @endif