forked from mirror/BlueMap
Implement webserver event in cli
This commit is contained in:
parent
c0c22fc6ea
commit
d43a08c92b
@ -31,6 +31,8 @@
|
|||||||
import de.bluecolored.bluemap.common.config.ConfigurationException;
|
import de.bluecolored.bluemap.common.config.ConfigurationException;
|
||||||
import de.bluecolored.bluemap.common.config.CoreConfig;
|
import de.bluecolored.bluemap.common.config.CoreConfig;
|
||||||
import de.bluecolored.bluemap.common.config.WebserverConfig;
|
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.plugin.RegionFileWatchService;
|
||||||
import de.bluecolored.bluemap.common.rendermanager.MapUpdateTask;
|
import de.bluecolored.bluemap.common.rendermanager.MapUpdateTask;
|
||||||
import de.bluecolored.bluemap.common.rendermanager.RenderManager;
|
import de.bluecolored.bluemap.common.rendermanager.RenderManager;
|
||||||
@ -236,12 +238,15 @@ public void startWebserver(BlueMapService blueMap, boolean verbose) throws IOExc
|
|||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//noinspection resource
|
|
||||||
HttpServer webServer = new HttpServer(handler);
|
HttpServer webServer = new HttpServer(handler);
|
||||||
webServer.bind(new InetSocketAddress(
|
webServer.bind(new InetSocketAddress(
|
||||||
config.resolveIp(),
|
config.resolveIp(),
|
||||||
config.getPort()
|
config.getPort()
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// webserver start event
|
||||||
|
EventUtils.dispatch(WebserverStartEvent.DISPATCHER, new WebserverStartEvent(webServer, routingRequestHandler));
|
||||||
|
|
||||||
webServer.start();
|
webServer.start();
|
||||||
} catch (UnknownHostException ex) {
|
} catch (UnknownHostException ex) {
|
||||||
throw new ConfigurationException("BlueMap failed to resolve the ip in your webserver-config.\n" +
|
throw new ConfigurationException("BlueMap failed to resolve the ip in your webserver-config.\n" +
|
||||||
|
Loading…
Reference in New Issue
Block a user