From 1d597d5d928964792ea9e74f4ee132f61295bd5b Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 14 Apr 2024 21:39:55 +0100 Subject: [PATCH] fix html motd --- .../xyz/mcutils/backend/common/ColorUtils.java | 2 ++ .../backend/controller/HomeController.java | 18 ++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/xyz/mcutils/backend/common/ColorUtils.java b/src/main/java/xyz/mcutils/backend/common/ColorUtils.java index e514d32..9840a9a 100644 --- a/src/main/java/xyz/mcutils/backend/common/ColorUtils.java +++ b/src/main/java/xyz/mcutils/backend/common/ColorUtils.java @@ -60,6 +60,7 @@ public final class ColorUtils { @NonNull public static String toHTML(@NonNull String input) { StringBuilder builder = new StringBuilder(); + builder.append(""); // Open the span tag boolean nextIsColor = false; // Is the next char a color code? for (char character : input.toCharArray()) { @@ -76,6 +77,7 @@ public final class ColorUtils { } builder.append(character); // Append the char... } + builder.append(""); // Close the span tag return builder.toString(); } } \ No newline at end of file diff --git a/src/main/java/xyz/mcutils/backend/controller/HomeController.java b/src/main/java/xyz/mcutils/backend/controller/HomeController.java index 281778b..6c3866b 100644 --- a/src/main/java/xyz/mcutils/backend/controller/HomeController.java +++ b/src/main/java/xyz/mcutils/backend/controller/HomeController.java @@ -9,22 +9,20 @@ import xyz.mcutils.backend.config.Config; @Controller @RequestMapping(value = "/") public class HomeController { - - /** - * The example UUID. - */ private final String examplePlayer = "Notch"; private final String exampleJavaServer = "aetheria.cc"; private final String exampleBedrockServer = "geo.hivebedrock.network"; @GetMapping(value = "/") public String home(Model model) { - model.addAttribute("public_url", Config.INSTANCE.getWebPublicUrl()); - model.addAttribute("player_example_url", Config.INSTANCE.getWebPublicUrl() + "/player/" + examplePlayer); - model.addAttribute("java_server_example_url", Config.INSTANCE.getWebPublicUrl() + "/server/java/" + exampleJavaServer); - model.addAttribute("bedrock_server_example_url", Config.INSTANCE.getWebPublicUrl() + "/server/bedrock/" + exampleBedrockServer); - model.addAttribute("mojang_endpoint_status_url", Config.INSTANCE.getWebPublicUrl() + "/mojang/status"); - model.addAttribute("swagger_url", Config.INSTANCE.getWebPublicUrl() + "/swagger-ui.html"); + String publicUrl = Config.INSTANCE.getWebPublicUrl(); + + model.addAttribute("public_url", publicUrl); + model.addAttribute("player_example_url", publicUrl + "/player/" + examplePlayer); + model.addAttribute("java_server_example_url", publicUrl + "/server/java/" + exampleJavaServer); + model.addAttribute("bedrock_server_example_url", publicUrl + "/server/bedrock/" + exampleBedrockServer); + model.addAttribute("mojang_endpoint_status_url", publicUrl + "/mojang/status"); + model.addAttribute("swagger_url", publicUrl + "/swagger-ui.html"); return "index"; } }