Updated README

This commit is contained in:
Jonas_Jones 2022-07-25 00:15:12 +02:00
parent ec3c622896
commit 4a08f71b13
19 changed files with 221 additions and 8 deletions

View file

@ -23,11 +23,16 @@ public class McWebserver implements ModInitializer {
ModConfigs.registerConfigs();
LOGGER.info("McWebserver initialized!");
LOGGER.info("Starting Webserver...");
new Thread(() -> {
new HTTPServer(new Socket());
HTTPServer.main();
}).start();
if (ModConfigs.ISENABLED) {
LOGGER.info("Starting Webserver...");
new Thread(() -> {
new HTTPServer(new Socket());
HTTPServer.main();
}).start();
} else {
LOGGER.info("Webserver disabled in the config file.");
}
}
}

View file

@ -35,7 +35,7 @@ public class ModConfigs {
}
private static void createConfigs() {
config.addKeyValuePair(new Pair<>("web.isEnabled", true), "whether or not the webserver should be enabled or not");
config.addKeyValuePair(new Pair<>("web.isEnabled", false), "whether or not the webserver should be enabled or not");
config.addKeyValuePair(new Pair<>("web.port", 8080), "The port of the webserver");
config.addKeyValuePair(new Pair<>("web.root", "webserver/"), "the root directory of the webserver, starting from the main server directory");
config.addKeyValuePair(new Pair<>("web.file.root", "index.html"), "the name of the html file for the homepage");
@ -45,7 +45,7 @@ public class ModConfigs {
}
private static void assignConfigs() {
ISENABLED = CONFIG.getOrDefault("basic.isEnabled", true);
ISENABLED = CONFIG.getOrDefault("basic.isEnabled", false);
WEB_PORT = CONFIG.getOrDefault("web.port", 8080);
WEB_ROOT = CONFIG.getOrDefault("web.root", "webserver/");
WEB_FILE_ROOT = CONFIG.getOrDefault("web.file.root", "index.html");