Sanitize host config to handle IP:Port format
All checks were successful
Build JStom / build (push) Successful in 1m26s

This commit is contained in:
2026-01-25 23:35:28 +00:00
parent c918695a68
commit 9bbdb92cdc

View File

@@ -28,7 +28,14 @@ public class Config {
if (data != null) { if (data != null) {
if (data.containsKey("port")) PORT = (int) data.get("port"); if (data.containsKey("port")) PORT = (int) data.get("port");
if (data.containsKey("motd")) MOTD = (String) data.get("motd"); if (data.containsKey("motd")) MOTD = (String) data.get("motd");
if (data.containsKey("host")) HOST = (String) data.get("host"); if (data.containsKey("host")) {
String rawHost = (String) data.get("host");
if (rawHost.contains(":")) {
HOST = rawHost.split(":")[0];
} else {
HOST = rawHost;
}
}
} }
} catch (IOException e) { } catch (IOException e) {
System.err.println("Could not load config.yml: " + e.getMessage()); System.err.println("Could not load config.yml: " + e.getMessage());