Bungee now sends a Wide Network page content generation request.

This commit is contained in:
Rsl1122 2018-02-10 20:51:37 +02:00
parent 26029e7853
commit dc7cc2daff
5 changed files with 62 additions and 15 deletions

View File

@ -83,9 +83,9 @@ public abstract class PlanSystem implements SubSystem {
configSystem,
databaseSystem,
webServerSystem,
processingQueue,
serverInfo,
infoSystem,
processingQueue,
cacheSystem,
listenerSystem,
taskSystem,

View File

@ -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,6 +39,7 @@ public class BukkitConnectionSystem extends ConnectionSystem {
}
private void refreshServerMap() {
Processor.queue(() -> {
if (latestServerMapRefresh < MiscUtils.getTime() - TimeAmount.SECOND.ms() * 15L) {
try {
Database database = Database.getActive();
@ -49,6 +51,7 @@ public class BukkitConnectionSystem extends ConnectionSystem {
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);
}
}

View File

@ -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());

View File

@ -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();
}
}

View File

@ -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();
}
}