From a423cee40ba81dfc8f7442f1cb26a7ddc9e6a336 Mon Sep 17 00:00:00 2001 From: amcmanu3 Date: Tue, 14 Feb 2023 13:59:53 -0500 Subject: [PATCH] Check for java on forge server creation --- app/classes/web/server_handler.py | 8 ++++++++ app/translations/en_EN.json | 1 + 2 files changed, 9 insertions(+) diff --git a/app/classes/web/server_handler.py b/app/classes/web/server_handler.py index da854cc5..f39979ce 100644 --- a/app/classes/web/server_handler.py +++ b/app/classes/web/server_handler.py @@ -404,6 +404,14 @@ class ServerHandler(BaseHandler): jar_type, server_type, server_version = server_parts # TODO: add server type check here and call the correct server # add functions if not a jar + if server_type == "forge" and not self.helper.detect_java(): + translation = self.helper.translation.translate( + "error", + "installerJava", + self.controller.users.get_user_lang_by_id(exec_user["user_id"]), + ).format(server_name) + self.redirect(f"/panel/error?error={translation}") + return new_server_id = self.controller.create_jar_server( jar_type, server_type, diff --git a/app/translations/en_EN.json b/app/translations/en_EN.json index fee43ec0..a7cb23fc 100644 --- a/app/translations/en_EN.json +++ b/app/translations/en_EN.json @@ -179,6 +179,7 @@ "internet": "We have detected the machine running Crafty has no connection to the internet. Client connections to the server may be limited.", "no-file": "We can't seem to locate the requested file. Double check the path. Does Crafty have proper permissions?", "noJava": "Server {} failed to start with error code: We have detected Java is not installed. Please install java then start the server.", + "installerJava": "Failed to install {} : Forge Server Installs require Java. We have detected Java is not installed. Please install java then install the server.", "not-downloaded": "We can't seem to find your executable file. Has it finished downloading? Are the permissions set to executable?", "portReminder": "We have detected this is the first time {} has been run. Make sure to forward port {} through your router/firewall to make this remotely accessible from the internet.", "start-error": "Server {} failed to start with error code: {}",