Sanitize host config to handle IP:Port format
All checks were successful
Build JStom / build (push) Successful in 1m26s
All checks were successful
Build JStom / build (push) Successful in 1m26s
This commit is contained in:
@@ -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());
|
||||||
|
|||||||
Reference in New Issue
Block a user