diff --git a/Plan/src/main/java/com/djrapitops/plan/system/PlanSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/PlanSystem.java index 8ffdb1267..5cd4d46e6 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/PlanSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/PlanSystem.java @@ -83,9 +83,9 @@ public abstract class PlanSystem implements SubSystem { configSystem, databaseSystem, webServerSystem, + processingQueue, serverInfo, infoSystem, - processingQueue, cacheSystem, listenerSystem, taskSystem, diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/connection/BukkitConnectionSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/info/connection/BukkitConnectionSystem.java index 0bb684306..7b48d74fb 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/info/connection/BukkitConnectionSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/info/connection/BukkitConnectionSystem.java @@ -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 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 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); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/connection/ConnectionSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/info/connection/ConnectionSystem.java index f874af6f7..0cdf67589 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/info/connection/ConnectionSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/info/connection/ConnectionSystem.java @@ -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()); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/request/GenerateNetworkPageContentRequest.java b/Plan/src/main/java/com/djrapitops/plan/system/info/request/GenerateNetworkPageContentRequest.java new file mode 100644 index 000000000..33d83d865 --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/info/request/GenerateNetworkPageContentRequest.java @@ -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 variables) throws WebException { + InfoSystem.getInstance().updateNetworkPage(); + return DefaultResponses.SUCCESS.get(); + } + + @Override + public void runLocally() throws WebException { + InfoSystem.getInstance().updateNetworkPage(); + } +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/system/tasks/bungee/EnableConnectionTask.java b/Plan/src/main/java/com/djrapitops/plan/system/tasks/bungee/EnableConnectionTask.java index 9a4e43627..33204938b 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/tasks/bungee/EnableConnectionTask.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/tasks/bungee/EnableConnectionTask.java @@ -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(); } }