Registered Plugins tab WebAPI

This commit is contained in:
Rsl1122 2017-09-17 12:33:35 +03:00
parent a1705b929d
commit e048fb6d64
4 changed files with 10 additions and 7 deletions

View File

@ -13,6 +13,8 @@ import main.java.com.djrapitops.plan.systems.webserver.webapi.WebAPIManager;
import main.java.com.djrapitops.plan.systems.webserver.webapi.bukkit.*; import main.java.com.djrapitops.plan.systems.webserver.webapi.bukkit.*;
import main.java.com.djrapitops.plan.systems.webserver.webapi.bungee.IsCachedWebAPI; import main.java.com.djrapitops.plan.systems.webserver.webapi.bungee.IsCachedWebAPI;
import main.java.com.djrapitops.plan.systems.webserver.webapi.bungee.PostHtmlWebAPI; import main.java.com.djrapitops.plan.systems.webserver.webapi.bungee.PostHtmlWebAPI;
import main.java.com.djrapitops.plan.systems.webserver.webapi.bungee.PostInspectPluginsTabWebAPI;
import main.java.com.djrapitops.plan.systems.webserver.webapi.bungee.RequestPluginsTabWebAPI;
import main.java.com.djrapitops.plan.systems.webserver.webapi.universal.PingWebAPI; import main.java.com.djrapitops.plan.systems.webserver.webapi.universal.PingWebAPI;
import main.java.com.djrapitops.plan.utilities.html.HtmlUtils; import main.java.com.djrapitops.plan.utilities.html.HtmlUtils;
@ -58,12 +60,15 @@ public class WebServer {
webAPI.registerNewAPI(new AnalyzeWebAPI()); webAPI.registerNewAPI(new AnalyzeWebAPI());
webAPI.registerNewAPI(new ConfigurationWebAPI()); webAPI.registerNewAPI(new ConfigurationWebAPI());
webAPI.registerNewAPI(new InspectWebAPI()); webAPI.registerNewAPI(new InspectWebAPI());
webAPI.registerNewAPI(new OnlinePlayersWebAPI()); webAPI.registerNewAPI(new GetOnlinePlayersWebAPI());
webAPI.registerNewAPI(new MaxPlayersWebAPI()); webAPI.registerNewAPI(new GetMaxPlayersWebAPI());
webAPI.registerNewAPI(new PingWebAPI()); webAPI.registerNewAPI(new PingWebAPI());
webAPI.registerNewAPI(new RequestInspectPluginsTabBukkitWebAPI());
webAPI.registerNewAPI(new IsCachedWebAPI()); webAPI.registerNewAPI(new IsCachedWebAPI());
webAPI.registerNewAPI(new PostHtmlWebAPI()); webAPI.registerNewAPI(new PostHtmlWebAPI());
webAPI.registerNewAPI(new PostInspectPluginsTabWebAPI());
webAPI.registerNewAPI(new RequestPluginsTabWebAPI());
} }
/** /**

View File

@ -14,7 +14,7 @@ import java.util.Map;
/** /**
* @author Rsl1122 * @author Rsl1122
*/ */
public class MaxPlayersWebAPI extends WebAPI { public class GetMaxPlayersWebAPI extends WebAPI {
@Override @Override
public Response onRequest(IPlan plugin, Map<String, String> variables) { public Response onRequest(IPlan plugin, Map<String, String> variables) {
return new JsonResponse(plugin.getVariable().getMaxPlayers()); return new JsonResponse(plugin.getVariable().getMaxPlayers());

View File

@ -15,7 +15,7 @@ import java.util.Map;
/** /**
* @author Fuzzlemann * @author Fuzzlemann
*/ */
public class OnlinePlayersWebAPI extends WebAPI { public class GetOnlinePlayersWebAPI extends WebAPI {
@Override @Override
public Response onRequest(IPlan plugin, Map<String, String> variables) { public Response onRequest(IPlan plugin, Map<String, String> variables) {
return new JsonResponse(((Plan) plugin).getServer().getOnlinePlayers()); return new JsonResponse(((Plan) plugin).getServer().getOnlinePlayers());

View File

@ -8,9 +8,7 @@ import com.djrapitops.plugin.utilities.Compatibility;
import main.java.com.djrapitops.plan.api.IPlan; import main.java.com.djrapitops.plan.api.IPlan;
import main.java.com.djrapitops.plan.api.exceptions.WebAPIException; import main.java.com.djrapitops.plan.api.exceptions.WebAPIException;
import main.java.com.djrapitops.plan.systems.info.BukkitInformationManager; import main.java.com.djrapitops.plan.systems.info.BukkitInformationManager;
import main.java.com.djrapitops.plan.systems.webserver.PageCache;
import main.java.com.djrapitops.plan.systems.webserver.response.Response; import main.java.com.djrapitops.plan.systems.webserver.response.Response;
import main.java.com.djrapitops.plan.systems.webserver.response.api.SuccessResponse;
import main.java.com.djrapitops.plan.systems.webserver.webapi.WebAPI; import main.java.com.djrapitops.plan.systems.webserver.webapi.WebAPI;
import java.util.Map; import java.util.Map;
@ -36,7 +34,7 @@ public class RequestInspectPluginsTabBukkitWebAPI extends WebAPI {
UUID uuid = UUID.fromString(uuidS); UUID uuid = UUID.fromString(uuidS);
((BukkitInformationManager) plugin.getInfoManager()).cacheInspectPluginsTab(uuid, this.getClass()); ((BukkitInformationManager) plugin.getInfoManager()).cacheInspectPluginsTab(uuid, this.getClass());
return PageCache.loadPage("success", SuccessResponse::new); return success();
} }
@Override @Override