File tree Expand file tree Collapse file tree 1 file changed +8
-15
lines changed
src/main/java/mindustrytool/handler Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Original file line number Diff line number Diff line change 5656public class HttpServer {
5757 private static final String MAP_PREVIEW_FILE_NAME = "MapPreview" ;
5858
59- private Javalin app ;
59+ private final Javalin app ;
6060
6161 private final ServerController controller ;
6262
6363 public HttpServer (ServerController controller ) {
6464 this .controller = controller ;
65- Log .info ("Http server created: " + this );
66- }
67-
68- public void init () {
69- Log .info ("Setup http server" );
70-
71- if (app != null ) {
72- throw new RuntimeException ("Already init" );
73- }
7465
7566 app = Javalin .create (config -> {
7667 config .showJavalinBanner = false ;
@@ -103,6 +94,12 @@ public void init() {
10394 });
10495 });
10596
97+ Log .info ("Http server created: " + this );
98+ }
99+
100+ public void init () {
101+ Log .info ("Setup http server" );
102+
106103 app .get ("stats" , context -> {
107104 context .future (() -> {
108105 var future = new CompletableFuture <>();
@@ -624,11 +621,7 @@ public byte[] mapPreview() {
624621 }
625622
626623 public void unload () {
627- if (app != null ) {
628- app .stop ();
629- app = null ;
630- Log .info ("Jetty server stopped" );
631- }
624+ app .stop ();
632625 Log .info ("Stop http server" );
633626 }
634627}
You can’t perform that action at this time.
0 commit comments