diff --git a/.gitignore b/.gitignore index c73249e..04b8e10 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,3 @@ # Maven log/ target/ -dependency-reduced-pom.xml - -# Java -*.jar diff --git a/pom.xml b/pom.xml index 1289a90..c4f8351 100644 --- a/pom.xml +++ b/pom.xml @@ -143,7 +143,7 @@ org.mongodb mongodb-driver-async - 3.2.2 + 3.12.11 fr.javatic.mongo diff --git a/src/main/java/net/frozenorb/apiv3/web/route/serverGroups/POSTServerGroups.java b/src/main/java/net/frozenorb/apiv3/web/route/serverGroups/POSTServerGroups.java index 94c6522..d653b39 100644 --- a/src/main/java/net/frozenorb/apiv3/web/route/serverGroups/POSTServerGroups.java +++ b/src/main/java/net/frozenorb/apiv3/web/route/serverGroups/POSTServerGroups.java @@ -25,7 +25,7 @@ public final class POSTServerGroups implements Handler { String image = requestBody.getString("image"); ServerGroup serverGroup = new ServerGroup(id, image); - SyncUtils.runBlocking(v -> serverGroup.insert(v)); + SyncUtils.runBlocking(serverGroup::insert); if (requestBody.containsKey("addedBy")) { AuditLog.log(UuidUtils.parseUuid(requestBody.getString("addedBy")), requestBody.getString("addedByIp"), ctx, AuditLogActionType.SERVER_GROUP_CREATE, ImmutableMap.of("serverGroupId", id), (ignored, error) -> { diff --git a/src/main/java/net/frozenorb/apiv3/web/route/servers/POSTServersHeartbeat.java b/src/main/java/net/frozenorb/apiv3/web/route/servers/POSTServersHeartbeat.java index da01e65..556af74 100644 --- a/src/main/java/net/frozenorb/apiv3/web/route/servers/POSTServersHeartbeat.java +++ b/src/main/java/net/frozenorb/apiv3/web/route/servers/POSTServersHeartbeat.java @@ -48,6 +48,7 @@ public final class POSTServersHeartbeat implements Handler { Server actorServer = Server.findById(actor.getName()); JsonObject requestBody = ctx.getBodyAsJson(); + System.out.println("body: " + requestBody); JsonObject players = requestBody.getJsonObject("players"); Map playerNames = extractPlayerNames(players); Map playerIps = extractPlayerIps(players); @@ -67,6 +68,7 @@ public final class POSTServersHeartbeat implements Handler { "events", result.result().result(3) )); } else { + result.cause().printStackTrace(); ErrorUtils.respondInternalError(ctx, result.cause()); } }); @@ -75,14 +77,16 @@ public final class POSTServersHeartbeat implements Handler { private Future createInfoResponse(Server server, double tps, Map playerNames) { Future callback = Future.future(); - server.receivedHeartbeat(tps, playerNames.keySet()); - server.save((ignored, error) -> { - if (error != null) { - callback.fail(error); - } else { - callback.complete(); - } - }); + if (server != null && playerNames != null) { + server.receivedHeartbeat(tps, playerNames.keySet()); + server.save((ignored, error) -> { + if (error != null) { + callback.fail(error); + } else { + callback.complete(); + } + }); + } return callback; }