mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-22 03:45:10 +01:00
Separate the dispatch and game servers (pt. 1)
gacha is still broken, handbook still needs to be done
This commit is contained in:
@@ -27,6 +27,12 @@ public final class HttpServer {
|
||||
* Configures the Javalin application.
|
||||
*/
|
||||
public HttpServer() {
|
||||
// Check if we are in game only mode.
|
||||
if (Grasscutter.getRunMode() == Grasscutter.ServerRunMode.GAME_ONLY) {
|
||||
this.javalin = null;
|
||||
return;
|
||||
}
|
||||
|
||||
this.javalin = Javalin.create(config -> {
|
||||
// Set the Javalin HTTP server.
|
||||
config.jetty.server(HttpServer::createServer);
|
||||
@@ -51,6 +57,13 @@ public final class HttpServer {
|
||||
|
||||
// Static files should be added like this https://javalin.io/documentation#static-files
|
||||
});
|
||||
|
||||
this.javalin.exception(Exception.class, (exception, ctx) -> {
|
||||
ctx.status(500).result("Internal server error. %s"
|
||||
.formatted(exception.getMessage()));
|
||||
Grasscutter.getLogger().debug("Exception thrown: " +
|
||||
exception.getMessage(), exception);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user