fix html motd

This commit is contained in:
Lee 2024-04-14 21:39:55 +01:00
parent 5877b100bc
commit 1d597d5d92
2 changed files with 10 additions and 10 deletions

@ -60,6 +60,7 @@ public final class ColorUtils {
@NonNull @NonNull
public static String toHTML(@NonNull String input) { public static String toHTML(@NonNull String input) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append("<span>"); // Open the span tag
boolean nextIsColor = false; // Is the next char a color code? boolean nextIsColor = false; // Is the next char a color code?
for (char character : input.toCharArray()) { for (char character : input.toCharArray()) {
@ -76,6 +77,7 @@ public final class ColorUtils {
} }
builder.append(character); // Append the char... builder.append(character); // Append the char...
} }
builder.append("</span>"); // Close the span tag
return builder.toString(); return builder.toString();
} }
} }

@ -9,22 +9,20 @@ import xyz.mcutils.backend.config.Config;
@Controller @Controller
@RequestMapping(value = "/") @RequestMapping(value = "/")
public class HomeController { public class HomeController {
/**
* The example UUID.
*/
private final String examplePlayer = "Notch"; private final String examplePlayer = "Notch";
private final String exampleJavaServer = "aetheria.cc"; private final String exampleJavaServer = "aetheria.cc";
private final String exampleBedrockServer = "geo.hivebedrock.network"; private final String exampleBedrockServer = "geo.hivebedrock.network";
@GetMapping(value = "/") @GetMapping(value = "/")
public String home(Model model) { public String home(Model model) {
model.addAttribute("public_url", Config.INSTANCE.getWebPublicUrl()); String publicUrl = 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("public_url", publicUrl);
model.addAttribute("bedrock_server_example_url", Config.INSTANCE.getWebPublicUrl() + "/server/bedrock/" + exampleBedrockServer); model.addAttribute("player_example_url", publicUrl + "/player/" + examplePlayer);
model.addAttribute("mojang_endpoint_status_url", Config.INSTANCE.getWebPublicUrl() + "/mojang/status"); model.addAttribute("java_server_example_url", publicUrl + "/server/java/" + exampleJavaServer);
model.addAttribute("swagger_url", Config.INSTANCE.getWebPublicUrl() + "/swagger-ui.html"); 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"; return "index";
} }
} }