mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-09-12 06:48:50 +02:00
Bungee now sends a Wide Network page content generation request.
This commit is contained in:
parent
26029e7853
commit
dc7cc2daff
@ -83,9 +83,9 @@ public abstract class PlanSystem implements SubSystem {
|
||||
configSystem,
|
||||
databaseSystem,
|
||||
webServerSystem,
|
||||
processingQueue,
|
||||
serverInfo,
|
||||
infoSystem,
|
||||
processingQueue,
|
||||
cacheSystem,
|
||||
listenerSystem,
|
||||
taskSystem,
|
||||
|
@ -11,6 +11,7 @@ import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.system.info.request.*;
|
||||
import com.djrapitops.plan.system.info.server.Server;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.system.processing.Processor;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plan.system.settings.locale.Locale;
|
||||
import com.djrapitops.plan.system.settings.locale.Msg;
|
||||
@ -38,17 +39,19 @@ public class BukkitConnectionSystem extends ConnectionSystem {
|
||||
}
|
||||
|
||||
private void refreshServerMap() {
|
||||
if (latestServerMapRefresh < MiscUtils.getTime() - TimeAmount.SECOND.ms() * 15L) {
|
||||
try {
|
||||
Database database = Database.getActive();
|
||||
Optional<Server> bungeeInformation = database.fetch().getBungeeInformation();
|
||||
bungeeInformation.ifPresent(server -> mainServer = server);
|
||||
bukkitServers = database.fetch().getBukkitServers();
|
||||
latestServerMapRefresh = MiscUtils.getTime();
|
||||
} catch (DBException e) {
|
||||
Log.toLog(this.getClass(), e);
|
||||
Processor.queue(() -> {
|
||||
if (latestServerMapRefresh < MiscUtils.getTime() - TimeAmount.SECOND.ms() * 15L) {
|
||||
try {
|
||||
Database database = Database.getActive();
|
||||
Optional<Server> bungeeInformation = database.fetch().getBungeeInformation();
|
||||
bungeeInformation.ifPresent(server -> mainServer = server);
|
||||
bukkitServers = database.fetch().getBukkitServers();
|
||||
latestServerMapRefresh = MiscUtils.getTime();
|
||||
} catch (DBException e) {
|
||||
Log.toLog(this.getClass(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -116,7 +119,7 @@ public class BukkitConnectionSystem extends ConnectionSystem {
|
||||
}
|
||||
if (usingBungeeWebServer && usingAlternativeIP) {
|
||||
String webServerAddress = WebServerSystem.getInstance().getWebServer().getAccessAddress();
|
||||
Log.info("Make sure that this address points to the Bukkit Server: " + webServerAddress);
|
||||
Log.info("Make sure that this address points to THIS Bukkit Server: " + webServerAddress);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,6 +120,7 @@ public abstract class ConnectionSystem implements SubSystem {
|
||||
putRequest(requests, GenerateAnalysisPageRequest.createHandler());
|
||||
putRequest(requests, GenerateInspectPageRequest.createHandler());
|
||||
putRequest(requests, GenerateInspectPluginsTabRequest.createHandler());
|
||||
putRequest(requests, GenerateNetworkPageContentRequest.createHandler());
|
||||
|
||||
putRequest(requests, SaveDBSettingsRequest.createHandler());
|
||||
putRequest(requests, SendDBSettingsRequest.createHandler());
|
||||
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Licence is provided in the jar as license.yml also here:
|
||||
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/license.yml
|
||||
*/
|
||||
package com.djrapitops.plan.system.info.request;
|
||||
|
||||
import com.djrapitops.plan.api.exceptions.connection.WebException;
|
||||
import com.djrapitops.plan.system.info.InfoSystem;
|
||||
import com.djrapitops.plan.system.webserver.response.DefaultResponses;
|
||||
import com.djrapitops.plan.system.webserver.response.Response;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* InfoRequest for generating network page content of a Bukkit server.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class GenerateNetworkPageContentRequest implements WideRequest, GenerateRequest {
|
||||
|
||||
public static GenerateNetworkPageContentRequest createHandler() {
|
||||
return new GenerateNetworkPageContentRequest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void placeDataToDatabase() {
|
||||
/* No Data needed on a GenerateRequest.*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response handleRequest(Map<String, String> variables) throws WebException {
|
||||
InfoSystem.getInstance().updateNetworkPage();
|
||||
return DefaultResponses.SUCCESS.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runLocally() throws WebException {
|
||||
InfoSystem.getInstance().updateNetworkPage();
|
||||
}
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
package com.djrapitops.plan.system.tasks.bungee;
|
||||
|
||||
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
||||
import com.djrapitops.plan.system.info.connection.WebExceptionLogger;
|
||||
import com.djrapitops.plan.system.info.request.GenerateNetworkPageContentRequest;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
|
||||
public class EnableConnectionTask extends AbsRunnable {
|
||||
@ -10,9 +13,9 @@ public class EnableConnectionTask extends AbsRunnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO Config InfoRequests.
|
||||
// infoManager.attemptConnection();
|
||||
// infoManager.sendConfigSettings();
|
||||
WebExceptionLogger.logIfOccurs(this.getClass(),
|
||||
() -> ConnectionSystem.getInstance().sendWideInfoRequest(new GenerateNetworkPageContentRequest())
|
||||
);
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user