Implement webserver event in cli

This commit is contained in:
Lukas Rieger (Blue) 2024-05-20 21:40:32 +02:00
parent c0c22fc6ea
commit d43a08c92b
No known key found for this signature in database
GPG Key ID: AA33883B1BBA03E6

View File

@ -31,6 +31,8 @@
import de.bluecolored.bluemap.common.config.ConfigurationException;
import de.bluecolored.bluemap.common.config.CoreConfig;
import de.bluecolored.bluemap.common.config.WebserverConfig;
import de.bluecolored.bluemap.common.events.EventUtils;
import de.bluecolored.bluemap.common.events.WebserverStartEvent;
import de.bluecolored.bluemap.common.plugin.RegionFileWatchService;
import de.bluecolored.bluemap.common.rendermanager.MapUpdateTask;
import de.bluecolored.bluemap.common.rendermanager.RenderManager;
@ -236,12 +238,15 @@ public void startWebserver(BlueMapService blueMap, boolean verbose) throws IOExc
);
try {
//noinspection resource
HttpServer webServer = new HttpServer(handler);
webServer.bind(new InetSocketAddress(
config.resolveIp(),
config.getPort()
));
// webserver start event
EventUtils.dispatch(WebserverStartEvent.DISPATCHER, new WebserverStartEvent(webServer, routingRequestHandler));
webServer.start();
} catch (UnknownHostException ex) {
throw new ConfigurationException("BlueMap failed to resolve the ip in your webserver-config.\n" +