mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-27 19:47:49 +01:00
Some parts to BungeeInformationManager
This commit is contained in:
parent
116675f8a6
commit
8ffcd302df
@ -11,8 +11,9 @@ import main.java.com.djrapitops.plan.bungee.PlanBungee;
|
|||||||
import main.java.com.djrapitops.plan.systems.cache.DataCache;
|
import main.java.com.djrapitops.plan.systems.cache.DataCache;
|
||||||
import main.java.com.djrapitops.plan.systems.info.server.ServerInfo;
|
import main.java.com.djrapitops.plan.systems.info.server.ServerInfo;
|
||||||
import main.java.com.djrapitops.plan.systems.webserver.PageCache;
|
import main.java.com.djrapitops.plan.systems.webserver.PageCache;
|
||||||
import main.java.com.djrapitops.plan.systems.webserver.response.InspectPageResponse;
|
import main.java.com.djrapitops.plan.systems.webserver.webapi.WebAPIManager;
|
||||||
import main.java.com.djrapitops.plan.systems.webserver.webapi.bukkit.AnalyzeWebAPI;
|
import main.java.com.djrapitops.plan.systems.webserver.webapi.bukkit.AnalyzeWebAPI;
|
||||||
|
import main.java.com.djrapitops.plan.systems.webserver.webapi.bungee.RequestPluginsTabWebAPI;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -75,8 +76,9 @@ public class BungeeInformationManager extends InformationManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cachePlayer(UUID uuid) {
|
public void cachePlayer(UUID uuid) {
|
||||||
PageCache.loadPage("inspectPage: " + uuid, () -> new InspectPageResponse(this, uuid));
|
// TODO Request Inspect from server where the player is online or any if offline
|
||||||
// TODO Player page plugin tab request
|
// PageCache.loadPage("inspectPage: " + uuid, () -> new InspectPageResponse(this, uuid));
|
||||||
|
getWebAPI().getAPI(RequestPluginsTabWebAPI.class).sendRequestsToBukkitServers(plugin, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -114,4 +116,9 @@ public class BungeeInformationManager extends InformationManager {
|
|||||||
perServerPluginsTab.put(serverUUID, html);
|
perServerPluginsTab.put(serverUUID, html);
|
||||||
pluginsTabContent.put(uuid, perServerPluginsTab);
|
pluginsTabContent.put(uuid, perServerPluginsTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private WebAPIManager getWebAPI() {
|
||||||
|
return plugin.getWebServer().getWebAPI();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -42,6 +42,21 @@ public class RequestPluginsTabWebAPI extends WebAPI {
|
|||||||
}
|
}
|
||||||
UUID uuid = UUID.fromString(uuidS);
|
UUID uuid = UUID.fromString(uuidS);
|
||||||
|
|
||||||
|
sendRequestsToBukkitServers(plugin, uuid);
|
||||||
|
return PageCache.loadPage("success", SuccessResponse::new);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendRequest(String address) throws WebAPIException {
|
||||||
|
throw new IllegalStateException("Wrong method call for this WebAPI, call sendRequest(String, UUID, UUID) instead.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendRequest(String address, UUID uuid) throws WebAPIException {
|
||||||
|
addVariable("uuid", uuid.toString());
|
||||||
|
super.sendRequest(address);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendRequestsToBukkitServers(IPlan plugin, UUID uuid) {
|
||||||
plugin.addToProcessQueue(new Processor<UUID>(uuid) {
|
plugin.addToProcessQueue(new Processor<UUID>(uuid) {
|
||||||
@Override
|
@Override
|
||||||
public void process() {
|
public void process() {
|
||||||
@ -60,16 +75,5 @@ public class RequestPluginsTabWebAPI extends WebAPI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return PageCache.loadPage("success", SuccessResponse::new);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendRequest(String address) throws WebAPIException {
|
|
||||||
throw new IllegalStateException("Wrong method call for this WebAPI, call sendRequest(String, UUID, UUID) instead.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void sendRequest(String address, UUID uuid) throws WebAPIException {
|
|
||||||
addVariable("uuid", uuid.toString());
|
|
||||||
super.sendRequest(address);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user