From f94fd33f5d4bfc917c404810b6a3fdecf234e4ad Mon Sep 17 00:00:00 2001 From: Colin McDonald Date: Sun, 7 Feb 2016 18:09:54 -0500 Subject: [PATCH] Fix a few things --- src/main/java/net/frozenorb/apiv3/APIv3.java | 6 +----- src/main/java/net/frozenorb/apiv3/types/Server.java | 4 ++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/frozenorb/apiv3/APIv3.java b/src/main/java/net/frozenorb/apiv3/APIv3.java index 048ae3c..9b3e009 100644 --- a/src/main/java/net/frozenorb/apiv3/APIv3.java +++ b/src/main/java/net/frozenorb/apiv3/APIv3.java @@ -31,12 +31,8 @@ public class APIv3 extends AbstractVerticle { ctx.next(); }); - Server.findServersByGroup("MineHG", res -> { - res.result().forEach(Server::update); - }); - coreHttpRouter.get("/servers").handler(ctx -> { - Server.findServersByGroup("MineHG", res -> { + Server.findAllServers(res -> { if (res.succeeded()) { JsonArray response = new JsonArray(); diff --git a/src/main/java/net/frozenorb/apiv3/types/Server.java b/src/main/java/net/frozenorb/apiv3/types/Server.java index 8b0b7e8..3952aa4 100644 --- a/src/main/java/net/frozenorb/apiv3/types/Server.java +++ b/src/main/java/net/frozenorb/apiv3/types/Server.java @@ -29,6 +29,10 @@ public final class Server { @Getter private double lastTps; @Getter private List players; + public static void findAllServers(Handler>> callback) { + MongoUtils.findManyAndTransform(COLLECTION_NAME, new JsonObject(), Server::new, callback); + } + public static void findServerById(String id, Handler> callback) { MongoUtils.findOneAndTransform(COLLECTION_NAME, new JsonObject().put("_id", id), Server::new, callback); }