From 00da5f673d8d775a499fed14b4b3b73e9797e142 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 30 May 2022 18:56:14 +0200 Subject: [PATCH] Update some stuff --- src/de/steamwar/bungeecore/api/WebAPI.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/de/steamwar/bungeecore/api/WebAPI.java b/src/de/steamwar/bungeecore/api/WebAPI.java index 1f06ebac..4901a0c3 100644 --- a/src/de/steamwar/bungeecore/api/WebAPI.java +++ b/src/de/steamwar/bungeecore/api/WebAPI.java @@ -23,8 +23,8 @@ import com.google.gson.JsonObject; import de.steamwar.bungeecore.api.v1.ServerstatusEndPoint; import de.steamwar.bungeecore.api.v1.ServerteamEndPoint; import de.steamwar.bungeecore.api.v1.statistics.*; -import de.steamwar.bungeecore.api.v1.user.GetUuidEndPoint; import de.steamwar.bungeecore.api.v1.user.GetUsernameEndPoint; +import de.steamwar.bungeecore.api.v1.user.GetUuidEndPoint; import de.steamwar.bungeecore.api.v1.website.LoginEndPoint; import de.steamwar.bungeecore.api.v1.website.LogoutEndPoint; @@ -33,7 +33,7 @@ import static spark.Spark.post; public class WebAPI { - private static EndPoint[] endPoints = new EndPoint[] { + private static EndPoint[] endPointsV1 = new EndPoint[] { new FightsEndPoint(), new HoursContributedEndPoint(), new HoursPlayedEndPoint(), @@ -47,9 +47,7 @@ public class WebAPI { new ServerteamEndPoint(), }; - public static void start() { - port(1024); - + private static void register(EndPoint[] endPoints) { for (EndPoint endPoint : endPoints) { post(endPoint.path(), (request, response) -> { JsonObject result = endPoint.result(request, response); @@ -61,4 +59,10 @@ public class WebAPI { }); } } + + public static void start() { + port(1024); + + register(endPointsV1); + } }