From feabb78dc32fd5689b6c3a8d5a84cc648f2bc6bd Mon Sep 17 00:00:00 2001 From: Martindev Date: Mon, 9 May 2022 11:47:39 +0200 Subject: [PATCH] Update PterodactylServerType.php --- src/Pterodactyl/PterodactylServerType.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Pterodactyl/PterodactylServerType.php b/src/Pterodactyl/PterodactylServerType.php index 34c34a3..d4031f1 100644 --- a/src/Pterodactyl/PterodactylServerType.php +++ b/src/Pterodactyl/PterodactylServerType.php @@ -194,16 +194,18 @@ public function createAccount(OrderItem $item): string $backups = $config->backups; $oom_disabled = (bool)$config->oomKill; - try { - $serviceId = (string)$item->getService()->getId(); - $id = $this->getServerId($serviceId, $item->getServer(), false); - $serverData['external_id'] = $serviceId; - $this->container->get(PterodactylMailer::class)->sendTo($item->getOrder()->getUser(), $item->getServer(), $item->getService(), $password); - $this->servers->saveServer($serviceId, $item->getServer()->getId(), $item->getItem()->getOrderable()->getId()); - return 'success'; - } catch (\Exception $e) { - - } + try { + $serviceId = (string)$item->getService()->getId(); + $id = $this->getServerId($serviceId, $item->getServer(), false); + + if ($id != null){ + $this->container->get(PterodactylMailer::class)->sendTo($item->getOrder()->getUser(), $item->getServer(), $item->getService(), $password); + $this->servers->saveServer($serviceId, $item->getServer()->getId(), $item->getItem()->getOrderable()->getId()); + return 'success'; + } + } catch (\Exception $e) { + + } $serverData = [ 'name' => $name, 'user' => (int)$userId,