Fix a few things
This commit is contained in:
parent
4b9b073e20
commit
f94fd33f5d
@ -31,12 +31,8 @@ public class APIv3 extends AbstractVerticle {
|
|||||||
ctx.next();
|
ctx.next();
|
||||||
});
|
});
|
||||||
|
|
||||||
Server.findServersByGroup("MineHG", res -> {
|
|
||||||
res.result().forEach(Server::update);
|
|
||||||
});
|
|
||||||
|
|
||||||
coreHttpRouter.get("/servers").handler(ctx -> {
|
coreHttpRouter.get("/servers").handler(ctx -> {
|
||||||
Server.findServersByGroup("MineHG", res -> {
|
Server.findAllServers(res -> {
|
||||||
if (res.succeeded()) {
|
if (res.succeeded()) {
|
||||||
JsonArray response = new JsonArray();
|
JsonArray response = new JsonArray();
|
||||||
|
|
||||||
|
@ -29,6 +29,10 @@ public final class Server {
|
|||||||
@Getter private double lastTps;
|
@Getter private double lastTps;
|
||||||
@Getter private List<UUID> players;
|
@Getter private List<UUID> players;
|
||||||
|
|
||||||
|
public static void findAllServers(Handler<AsyncResult<List<Server>>> callback) {
|
||||||
|
MongoUtils.findManyAndTransform(COLLECTION_NAME, new JsonObject(), Server::new, callback);
|
||||||
|
}
|
||||||
|
|
||||||
public static void findServerById(String id, Handler<AsyncResult<Server>> callback) {
|
public static void findServerById(String id, Handler<AsyncResult<Server>> callback) {
|
||||||
MongoUtils.findOneAndTransform(COLLECTION_NAME, new JsonObject().put("_id", id), Server::new, callback);
|
MongoUtils.findOneAndTransform(COLLECTION_NAME, new JsonObject().put("_id", id), Server::new, callback);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user