From a8126f6669c6461624a57f5ffb21fbd027cbe6ee Mon Sep 17 00:00:00 2001 From: Rsl1122 <24460436+Rsl1122@users.noreply.github.com> Date: Mon, 2 Mar 2020 13:43:30 +0200 Subject: [PATCH] Rename VersionCheckSystem -> VersionChecker --- .../placeholderapi/PlanPlaceHolders.java | 9 ++++--- .../java/com/djrapitops/plan/PlanSystem.java | 18 ++++++------- .../commands/subcommands/InfoCommand.java | 10 +++---- .../plan/delivery/domain/WebUser.java | 2 ++ .../delivery/rendering/pages/DebugPage.java | 14 +++++----- .../rendering/pages/ErrorMessagePage.java | 16 +++++------ .../rendering/pages/InternalErrorPage.java | 12 ++++----- .../delivery/rendering/pages/NetworkPage.java | 12 ++++----- .../delivery/rendering/pages/PageFactory.java | 27 ++++++++++--------- .../delivery/rendering/pages/PlayerPage.java | 12 ++++----- .../delivery/rendering/pages/PlayersPage.java | 12 ++++----- .../delivery/rendering/pages/ServerPage.java | 12 ++++----- .../delivery/webserver/ResponseFactory.java | 8 +++--- .../plan/settings/locale/Locale.java | 1 + ...onCheckSystem.java => VersionChecker.java} | 4 +-- 15 files changed, 88 insertions(+), 81 deletions(-) rename Plan/common/src/main/java/com/djrapitops/plan/version/{VersionCheckSystem.java => VersionChecker.java} (98%) diff --git a/Plan/bukkit/src/main/java/com/djrapitops/plan/addons/placeholderapi/PlanPlaceHolders.java b/Plan/bukkit/src/main/java/com/djrapitops/plan/addons/placeholderapi/PlanPlaceHolders.java index 49c8ae84f..2edade0f4 100644 --- a/Plan/bukkit/src/main/java/com/djrapitops/plan/addons/placeholderapi/PlanPlaceHolders.java +++ b/Plan/bukkit/src/main/java/com/djrapitops/plan/addons/placeholderapi/PlanPlaceHolders.java @@ -23,7 +23,7 @@ import com.djrapitops.plan.delivery.formatting.Formatters; import com.djrapitops.plan.identification.ServerInfo; import com.djrapitops.plan.settings.config.PlanConfig; import com.djrapitops.plan.storage.database.DBSystem; -import com.djrapitops.plan.version.VersionCheckSystem; +import com.djrapitops.plan.version.VersionChecker; import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.error.ErrorHandler; import me.clip.placeholderapi.expansion.PlaceholderExpansion; @@ -54,13 +54,13 @@ public class PlanPlaceHolders extends PlaceholderExpansion { public final ErrorHandler errorHandler; private final Collection placeholders = new ArrayList<>(); - private final VersionCheckSystem versionCheckSystem; + private final VersionChecker versionChecker; public PlanPlaceHolders( PlanSystem system, ErrorHandler errorHandler ) { - this.versionCheckSystem = system.getVersionCheckSystem(); + this.versionChecker = system.getVersionChecker(); this.errorHandler = errorHandler; PlanConfig config = system.getConfigSystem().getConfig(); @@ -90,6 +90,7 @@ public class PlanPlaceHolders extends PlaceholderExpansion { return "plan"; } + @SuppressWarnings("deprecation") @Override public String getPlugin() { return "Plan"; @@ -102,7 +103,7 @@ public class PlanPlaceHolders extends PlaceholderExpansion { @Override public String getVersion() { - return versionCheckSystem.getCurrentVersion(); + return versionChecker.getCurrentVersion(); } @Override diff --git a/Plan/common/src/main/java/com/djrapitops/plan/PlanSystem.java b/Plan/common/src/main/java/com/djrapitops/plan/PlanSystem.java index a68990d9b..218b75d60 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/PlanSystem.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/PlanSystem.java @@ -40,7 +40,7 @@ import com.djrapitops.plan.settings.locale.LocaleSystem; import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.queries.objects.ServerQueries; import com.djrapitops.plan.storage.file.PlanFiles; -import com.djrapitops.plan.version.VersionCheckSystem; +import com.djrapitops.plan.version.VersionChecker; import com.djrapitops.plugin.benchmarking.Benchmark; import com.djrapitops.plugin.benchmarking.Timings; import com.djrapitops.plugin.logging.L; @@ -64,7 +64,7 @@ public class PlanSystem implements SubSystem { private final PlanFiles files; private final ConfigSystem configSystem; - private final VersionCheckSystem versionCheckSystem; + private final VersionChecker versionChecker; private final LocaleSystem localeSystem; private final DBSystem databaseSystem; private final CacheSystem cacheSystem; @@ -90,7 +90,7 @@ public class PlanSystem implements SubSystem { public PlanSystem( PlanFiles files, ConfigSystem configSystem, - VersionCheckSystem versionCheckSystem, + VersionChecker versionChecker, LocaleSystem localeSystem, DBSystem databaseSystem, CacheSystem cacheSystem, @@ -113,7 +113,7 @@ public class PlanSystem implements SubSystem { ) { this.files = files; this.configSystem = configSystem; - this.versionCheckSystem = versionCheckSystem; + this.versionChecker = versionChecker; this.localeSystem = localeSystem; this.databaseSystem = databaseSystem; this.cacheSystem = cacheSystem; @@ -138,7 +138,7 @@ public class PlanSystem implements SubSystem { "§2 ██▌", "§2 ██▌ ██▌", "§2 ██▌██▌██▌██▌ §2Player Analytics", - "§2 ██▌██▌██▌██▌ §fv" + versionCheckSystem.getCurrentVersion(), + "§2 ██▌██▌██▌██▌ §fv" + versionChecker.getCurrentVersion(), "" ); } @@ -166,7 +166,7 @@ public class PlanSystem implements SubSystem { files, configSystem, localeSystem, - versionCheckSystem, + versionChecker, databaseSystem, webServerSystem, processing, @@ -217,7 +217,7 @@ public class PlanSystem implements SubSystem { localeSystem, configSystem, files, - versionCheckSystem + versionChecker ); } @@ -235,8 +235,8 @@ public class PlanSystem implements SubSystem { // Accessor methods. - public VersionCheckSystem getVersionCheckSystem() { - return versionCheckSystem; + public VersionChecker getVersionChecker() { + return versionChecker; } public ConfigSystem getConfigSystem() { diff --git a/Plan/common/src/main/java/com/djrapitops/plan/commands/subcommands/InfoCommand.java b/Plan/common/src/main/java/com/djrapitops/plan/commands/subcommands/InfoCommand.java index 1adac1e24..0892bcd52 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/commands/subcommands/InfoCommand.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/commands/subcommands/InfoCommand.java @@ -25,7 +25,7 @@ import com.djrapitops.plan.settings.locale.lang.GenericLang; import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.queries.objects.ServerQueries; -import com.djrapitops.plan.version.VersionCheckSystem; +import com.djrapitops.plan.version.VersionChecker; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.Sender; @@ -42,21 +42,21 @@ public class InfoCommand extends CommandNode { private final PlanPlugin plugin; private final Locale locale; private final DBSystem dbSystem; - private final VersionCheckSystem versionCheckSystem; + private final VersionChecker versionChecker; @Inject public InfoCommand( PlanPlugin plugin, Locale locale, DBSystem dbSystem, - VersionCheckSystem versionCheckSystem + VersionChecker versionChecker ) { super("info", Permissions.INFO.getPermission(), CommandType.CONSOLE); this.plugin = plugin; this.locale = locale; this.dbSystem = dbSystem; - this.versionCheckSystem = versionCheckSystem; + this.versionChecker = versionChecker; setShortHelp(locale.get(CmdHelpLang.INFO).toString()); } @@ -68,7 +68,7 @@ public class InfoCommand extends CommandNode { Database database = dbSystem.getDatabase(); - String updateAvailable = versionCheckSystem.isNewVersionAvailable() ? yes : no; + String updateAvailable = versionChecker.isNewVersionAvailable() ? yes : no; String proxyAvailable = database.query(ServerQueries.fetchProxyServerInformation()).isPresent() ? yes : no; diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/domain/WebUser.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/domain/WebUser.java index d49a46254..799574503 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/domain/WebUser.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/domain/WebUser.java @@ -24,6 +24,8 @@ import java.util.Objects; * Object containing webserver security user information. * * @author Rsl1122 + * + * TODO Rewrite Authentication stuff */ @Deprecated public class WebUser { diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/DebugPage.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/DebugPage.java index 6bd04384c..44d110b77 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/DebugPage.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/DebugPage.java @@ -32,7 +32,7 @@ import com.djrapitops.plan.identification.properties.ServerProperties; import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.file.FileResource; import com.djrapitops.plan.storage.file.ResourceCache; -import com.djrapitops.plan.version.VersionCheckSystem; +import com.djrapitops.plan.version.VersionChecker; import com.djrapitops.plugin.benchmarking.Benchmark; import com.djrapitops.plugin.benchmarking.Timings; import com.djrapitops.plugin.logging.FolderTimeStampFileLogger; @@ -57,7 +57,7 @@ public class DebugPage implements Page { private final String template; private final Database database; private final ServerInfo serverInfo; - private final VersionCheckSystem versionCheckSystem; + private final VersionChecker versionChecker; private final CombineDebugLogger debugLogger; private final Timings timings; private final ErrorHandler errorHandler; @@ -70,7 +70,7 @@ public class DebugPage implements Page { Database database, ServerInfo serverInfo, Formatters formatters, - VersionCheckSystem versionCheckSystem, + VersionChecker versionChecker, DebugLogger debugLogger, Timings timings, ErrorHandler errorHandler @@ -79,7 +79,7 @@ public class DebugPage implements Page { this.database = database; this.serverInfo = serverInfo; - this.versionCheckSystem = versionCheckSystem; + this.versionChecker = versionChecker; this.debugLogger = (CombineDebugLogger) debugLogger; this.timings = timings; this.errorHandler = errorHandler; @@ -93,8 +93,8 @@ public class DebugPage implements Page { placeholders.put("title", Icon.called("bug") + " Debug Information"); placeholders.put("titleText", "Debug Information"); placeholders.put("paragraph", createContent()); - placeholders.put("version", versionCheckSystem.getUpdateButton().orElse(versionCheckSystem.getCurrentVersionButton())); - placeholders.put("updateModal", versionCheckSystem.getUpdateModal()); + placeholders.put("version", versionChecker.getUpdateButton().orElse(versionChecker.getCurrentVersionButton())); + placeholders.put("updateModal", versionChecker.getUpdateModal()); placeholders.put("contributors", Contributors.generateContributorHtml()); return placeholders.apply(template); } @@ -207,7 +207,7 @@ public class DebugPage implements Page { content.append("
### Server Information
") .append("**Plan Version:** ") - .append(versionCheckSystem.getCurrentVersion()) + .append(versionChecker.getCurrentVersion()) .append("
"); content.append("**Server:** "); diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/ErrorMessagePage.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/ErrorMessagePage.java index b43ef700e..f43dc9e49 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/ErrorMessagePage.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/ErrorMessagePage.java @@ -19,7 +19,7 @@ package com.djrapitops.plan.delivery.rendering.pages; import com.djrapitops.plan.delivery.formatting.PlaceholderReplacer; import com.djrapitops.plan.delivery.rendering.html.Contributors; import com.djrapitops.plan.delivery.rendering.html.icon.Icon; -import com.djrapitops.plan.version.VersionCheckSystem; +import com.djrapitops.plan.version.VersionChecker; /** * Page to display error stacktrace. @@ -33,24 +33,24 @@ public class ErrorMessagePage implements Page { private final String errorTitle; private final String errorMsg; - private final VersionCheckSystem versionCheckSystem; + private final VersionChecker versionChecker; public ErrorMessagePage( String template, Icon icon, String errorTitle, String errorMsg, - VersionCheckSystem versionCheckSystem + VersionChecker versionChecker ) { this.template = template; this.icon = icon; this.errorTitle = errorTitle; this.errorMsg = errorMsg; - this.versionCheckSystem = versionCheckSystem; + this.versionChecker = versionChecker; } public ErrorMessagePage( String template, String errorTitle, String errorMsg, - VersionCheckSystem versionCheckSystem + VersionChecker versionChecker ) { - this(template, Icon.called("exclamation-circle").build(), errorTitle, errorMsg, versionCheckSystem); + this(template, Icon.called("exclamation-circle").build(), errorTitle, errorMsg, versionChecker); } @Override @@ -60,8 +60,8 @@ public class ErrorMessagePage implements Page { placeholders.put("title", icon.toHtml() + " " + errorTitle); placeholders.put("titleText", errorTitle); placeholders.put("paragraph", errorMsg); - placeholders.put("version", versionCheckSystem.getUpdateButton().orElse(versionCheckSystem.getCurrentVersionButton())); - placeholders.put("updateModal", versionCheckSystem.getUpdateModal()); + placeholders.put("version", versionChecker.getUpdateButton().orElse(versionChecker.getCurrentVersionButton())); + placeholders.put("updateModal", versionChecker.getUpdateModal()); placeholders.put("contributors", Contributors.generateContributorHtml()); return placeholders.apply(template); } diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/InternalErrorPage.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/InternalErrorPage.java index 1a2914465..23def0cc9 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/InternalErrorPage.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/InternalErrorPage.java @@ -20,7 +20,7 @@ import com.djrapitops.plan.delivery.formatting.PlaceholderReplacer; import com.djrapitops.plan.delivery.rendering.html.Contributors; import com.djrapitops.plan.delivery.rendering.html.Html; import com.djrapitops.plan.delivery.rendering.html.icon.Icon; -import com.djrapitops.plan.version.VersionCheckSystem; +import com.djrapitops.plan.version.VersionChecker; /** * Page to display error stacktrace. @@ -33,16 +33,16 @@ public class InternalErrorPage implements Page { private final String errorMsg; private final Throwable error; - private final VersionCheckSystem versionCheckSystem; + private final VersionChecker versionChecker; public InternalErrorPage( String template, String errorMsg, Throwable error, - VersionCheckSystem versionCheckSystem + VersionChecker versionChecker ) { this.template = template; this.errorMsg = errorMsg; this.error = error; - this.versionCheckSystem = versionCheckSystem; + this.versionChecker = versionChecker; } @Override @@ -52,8 +52,8 @@ public class InternalErrorPage implements Page { placeholders.put("title", Icon.called("bug") + " 500 Internal Error occurred"); placeholders.put("titleText", "500 Internal Error occurred"); placeholders.put("paragraph", createContent()); - placeholders.put("version", versionCheckSystem.getUpdateButton().orElse(versionCheckSystem.getCurrentVersionButton())); - placeholders.put("updateModal", versionCheckSystem.getUpdateModal()); + placeholders.put("version", versionChecker.getUpdateButton().orElse(versionChecker.getCurrentVersionButton())); + placeholders.put("updateModal", versionChecker.getUpdateModal()); placeholders.put("contributors", Contributors.generateContributorHtml()); return placeholders.apply(template); } diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/NetworkPage.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/NetworkPage.java index 2c83c5394..6db271413 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/NetworkPage.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/NetworkPage.java @@ -30,7 +30,7 @@ import com.djrapitops.plan.settings.config.paths.ProxySettings; import com.djrapitops.plan.settings.theme.Theme; import com.djrapitops.plan.settings.theme.ThemeVal; import com.djrapitops.plan.storage.database.DBSystem; -import com.djrapitops.plan.version.VersionCheckSystem; +import com.djrapitops.plan.version.VersionChecker; import org.apache.commons.lang3.StringUtils; import java.util.List; @@ -46,7 +46,7 @@ public class NetworkPage implements Page { private final String templateHtml; private final DBSystem dbSystem; - private final VersionCheckSystem versionCheckSystem; + private final VersionChecker versionChecker; private final PlanConfig config; private final Theme theme; private final ServerInfo serverInfo; @@ -56,7 +56,7 @@ public class NetworkPage implements Page { String templateHtml, DBSystem dbSystem, - VersionCheckSystem versionCheckSystem, + VersionChecker versionChecker, PlanConfig config, Theme theme, ServerInfo serverInfo, @@ -64,7 +64,7 @@ public class NetworkPage implements Page { ) { this.templateHtml = templateHtml; this.dbSystem = dbSystem; - this.versionCheckSystem = versionCheckSystem; + this.versionChecker = versionChecker; this.config = config; this.theme = theme; this.serverInfo = serverInfo; @@ -89,8 +89,8 @@ public class NetworkPage implements Page { placeholders.put("avgPingColor", theme.getValue(ThemeVal.GRAPH_AVG_PING)); placeholders.put("timeZone", config.getTimeZoneOffsetHours()); - placeholders.put("version", versionCheckSystem.getUpdateButton().orElse(versionCheckSystem.getCurrentVersionButton())); - placeholders.put("updateModal", versionCheckSystem.getUpdateModal()); + placeholders.put("version", versionChecker.getUpdateButton().orElse(versionChecker.getCurrentVersionButton())); + placeholders.put("updateModal", versionChecker.getUpdateModal()); placeholders.put("contributors", Contributors.generateContributorHtml()); CachingSupplier pluginTabs = new CachingSupplier<>(() -> { diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/PageFactory.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/PageFactory.java index 7528bcffb..cf3dd16ef 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/PageFactory.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/PageFactory.java @@ -31,7 +31,7 @@ import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.queries.containers.ContainerFetchQueries; import com.djrapitops.plan.storage.database.queries.objects.ServerQueries; import com.djrapitops.plan.storage.file.PlanFiles; -import com.djrapitops.plan.version.VersionCheckSystem; +import com.djrapitops.plan.version.VersionChecker; import com.djrapitops.plugin.benchmarking.Timings; import com.djrapitops.plugin.logging.debug.DebugLogger; import com.djrapitops.plugin.logging.error.ErrorHandler; @@ -52,9 +52,10 @@ import java.util.*; @Singleton public class PageFactory { - private final Lazy versionCheckSystem; + private final Lazy versionChecker; private final Lazy files; private final Lazy config; + private final Lazy locale; private final Lazy theme; private final Lazy dbSystem; private final Lazy serverInfo; @@ -65,9 +66,10 @@ public class PageFactory { @Inject public PageFactory( - Lazy versionCheckSystem, + Lazy versionChecker, Lazy files, Lazy config, + Lazy locale, Lazy theme, Lazy dbSystem, Lazy serverInfo, @@ -76,9 +78,10 @@ public class PageFactory { Lazy timings, Lazy errorHandler ) { - this.versionCheckSystem = versionCheckSystem; + this.versionChecker = versionChecker; this.files = files; this.config = config; + this.locale = locale; this.theme = theme; this.dbSystem = dbSystem; this.serverInfo = serverInfo; @@ -91,13 +94,13 @@ public class PageFactory { public DebugPage debugPage() throws IOException { return new DebugPage( getResource("web/error.html"), - dbSystem.get().getDatabase(), serverInfo.get(), formatters.get(), versionCheckSystem.get(), + dbSystem.get().getDatabase(), serverInfo.get(), formatters.get(), versionChecker.get(), debugLogger.get(), timings.get(), errorHandler.get() ); } public PlayersPage playersPage() throws IOException { - return new PlayersPage(getResource("web/players.html"), versionCheckSystem.get(), config.get(), serverInfo.get()); + return new PlayersPage(getResource("web/players.html"), versionChecker.get(), config.get(), serverInfo.get()); } public ServerPage serverPage(UUID serverUUID) throws NotFoundException, IOException { @@ -108,7 +111,7 @@ public class PageFactory { server, config.get(), theme.get(), - versionCheckSystem.get(), + versionChecker.get(), dbSystem.get(), serverInfo.get(), formatters.get() @@ -120,7 +123,7 @@ public class PageFactory { PlayerContainer player = db.query(ContainerFetchQueries.fetchPlayerContainer(playerUUID)); return new PlayerPage( getResource("web/player.html"), player, - versionCheckSystem.get(), + versionChecker.get(), config.get(), this, theme.get(), formatters.get(), serverInfo.get() ); @@ -162,14 +165,14 @@ public class PageFactory { public NetworkPage networkPage() throws IOException { return new NetworkPage(getResource("web/network.html"), dbSystem.get(), - versionCheckSystem.get(), config.get(), theme.get(), serverInfo.get(), formatters.get()); + versionChecker.get(), config.get(), theme.get(), serverInfo.get(), formatters.get()); } public Page internalErrorPage(String message, Throwable error) { try { return new InternalErrorPage( getResource("web/error.html"), message, error, - versionCheckSystem.get()); + versionChecker.get()); } catch (IOException noParse) { return () -> "Error occurred: " + error.toString() + ", additional error occurred when attempting to render error page to user: " + @@ -180,13 +183,13 @@ public class PageFactory { public Page errorPage(String title, String error) throws IOException { return new ErrorMessagePage( getResource("web/error.html"), title, error, - versionCheckSystem.get()); + versionChecker.get()); } public Page errorPage(Icon icon, String title, String error) throws IOException { return new ErrorMessagePage( getResource("web/error.html"), icon, title, error, - versionCheckSystem.get()); + versionChecker.get()); } public String getResource(String name) throws IOException { diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/PlayerPage.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/PlayerPage.java index ba127bb7e..d1438f191 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/PlayerPage.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/PlayerPage.java @@ -27,7 +27,7 @@ import com.djrapitops.plan.identification.ServerInfo; import com.djrapitops.plan.settings.config.PlanConfig; import com.djrapitops.plan.settings.theme.Theme; import com.djrapitops.plan.settings.theme.ThemeVal; -import com.djrapitops.plan.version.VersionCheckSystem; +import com.djrapitops.plan.version.VersionChecker; import java.util.UUID; @@ -41,7 +41,7 @@ public class PlayerPage implements Page { private final String templateHtml; private final PlayerContainer player; - private final VersionCheckSystem versionCheckSystem; + private final VersionChecker versionChecker; private final PlanConfig config; private final PageFactory pageFactory; @@ -54,7 +54,7 @@ public class PlayerPage implements Page { PlayerPage( String templateHtml, PlayerContainer player, - VersionCheckSystem versionCheckSystem, + VersionChecker versionChecker, PlanConfig config, PageFactory pageFactory, Theme theme, @@ -63,7 +63,7 @@ public class PlayerPage implements Page { ) { this.templateHtml = templateHtml; this.player = player; - this.versionCheckSystem = versionCheckSystem; + this.versionChecker = versionChecker; this.config = config; this.pageFactory = pageFactory; this.theme = theme; @@ -89,8 +89,8 @@ public class PlayerPage implements Page { placeholders.put("refresh", clockLongFormatter.apply(now)); placeholders.put("refreshFull", secondLongFormatter.apply(now)); - placeholders.put("version", versionCheckSystem.getUpdateButton().orElse(versionCheckSystem.getCurrentVersionButton())); - placeholders.put("updateModal", versionCheckSystem.getUpdateModal()); + placeholders.put("version", versionChecker.getUpdateButton().orElse(versionChecker.getCurrentVersionButton())); + placeholders.put("updateModal", versionChecker.getUpdateModal()); placeholders.put("timeZone", config.getTimeZoneOffsetHours()); String playerName = player.getValue(PlayerKeys.NAME).orElse(playerUUID.toString()); diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/PlayersPage.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/PlayersPage.java index 754ca076f..7abe519a6 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/PlayersPage.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/PlayersPage.java @@ -22,7 +22,7 @@ import com.djrapitops.plan.identification.ServerInfo; import com.djrapitops.plan.settings.config.PlanConfig; import com.djrapitops.plan.settings.config.paths.PluginSettings; import com.djrapitops.plan.settings.config.paths.ProxySettings; -import com.djrapitops.plan.version.VersionCheckSystem; +import com.djrapitops.plan.version.VersionChecker; /** * Html String generator for /players page. @@ -32,18 +32,18 @@ import com.djrapitops.plan.version.VersionCheckSystem; public class PlayersPage implements Page { private final String templateHtml; - private final VersionCheckSystem versionCheckSystem; + private final VersionChecker versionChecker; private final PlanConfig config; private final ServerInfo serverInfo; PlayersPage( String templateHtml, - VersionCheckSystem versionCheckSystem, + VersionChecker versionChecker, PlanConfig config, ServerInfo serverInfo ) { this.templateHtml = templateHtml; - this.versionCheckSystem = versionCheckSystem; + this.versionChecker = versionChecker; this.config = config; this.serverInfo = serverInfo; } @@ -52,8 +52,8 @@ public class PlayersPage implements Page { public String toHtml() { PlaceholderReplacer placeholders = new PlaceholderReplacer(); - placeholders.put("version", versionCheckSystem.getUpdateButton().orElse(versionCheckSystem.getCurrentVersionButton())); - placeholders.put("updateModal", versionCheckSystem.getUpdateModal()); + placeholders.put("version", versionChecker.getUpdateButton().orElse(versionChecker.getCurrentVersionButton())); + placeholders.put("updateModal", versionChecker.getUpdateModal()); placeholders.put("contributors", Contributors.generateContributorHtml()); if (serverInfo.getServer().isProxy()) { placeholders.put("networkName", config.get(ProxySettings.NETWORK_NAME)); diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/ServerPage.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/ServerPage.java index 65d4dcebd..43bfcb913 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/ServerPage.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/ServerPage.java @@ -35,7 +35,7 @@ import com.djrapitops.plan.settings.config.paths.DisplaySettings; import com.djrapitops.plan.settings.theme.Theme; import com.djrapitops.plan.settings.theme.ThemeVal; import com.djrapitops.plan.storage.database.DBSystem; -import com.djrapitops.plan.version.VersionCheckSystem; +import com.djrapitops.plan.version.VersionChecker; import java.util.List; import java.util.UUID; @@ -53,7 +53,7 @@ public class ServerPage implements Page { private final Server server; private final PlanConfig config; private final Theme theme; - private final VersionCheckSystem versionCheckSystem; + private final VersionChecker versionChecker; private final DBSystem dbSystem; private final ServerInfo serverInfo; private final Formatters formatters; @@ -62,7 +62,7 @@ public class ServerPage implements Page { String templateHtml, Server server, PlanConfig config, Theme theme, - VersionCheckSystem versionCheckSystem, + VersionChecker versionChecker, DBSystem dbSystem, ServerInfo serverInfo, Formatters formatters @@ -71,7 +71,7 @@ public class ServerPage implements Page { this.server = server; this.config = config; this.theme = theme; - this.versionCheckSystem = versionCheckSystem; + this.versionChecker = versionChecker; this.dbSystem = dbSystem; this.serverInfo = serverInfo; this.formatters = formatters; @@ -121,8 +121,8 @@ public class ServerPage implements Page { placeholders.put("backButton", serverInfo.getServer().isProxy() ? Html.BACK_BUTTON_NETWORK.create() : ""); placeholders.put("contributors", Contributors.generateContributorHtml()); - placeholders.put("version", versionCheckSystem.getUpdateButton().orElse(versionCheckSystem.getCurrentVersionButton())); - placeholders.put("updateModal", versionCheckSystem.getUpdateModal()); + placeholders.put("version", versionChecker.getUpdateButton().orElse(versionChecker.getCurrentVersionButton())); + placeholders.put("updateModal", versionChecker.getUpdateModal()); CachingSupplier pluginTabs = new CachingSupplier<>(() -> { List extensionData = dbSystem.getDatabase().query(new ExtensionServerDataQuery(serverUUID)); diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/webserver/ResponseFactory.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/webserver/ResponseFactory.java index d2eda281b..96b672634 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/webserver/ResponseFactory.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/webserver/ResponseFactory.java @@ -33,7 +33,7 @@ import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.queries.containers.ContainerFetchQueries; import com.djrapitops.plan.storage.file.PlanFiles; -import com.djrapitops.plan.version.VersionCheckSystem; +import com.djrapitops.plan.version.VersionChecker; import javax.inject.Inject; import javax.inject.Singleton; @@ -51,7 +51,7 @@ import java.util.UUID; @Singleton public class ResponseFactory { - private final VersionCheckSystem versionCheckSystem; + private final VersionChecker versionChecker; private final PlanFiles files; private final PageFactory pageFactory; private final Locale locale; @@ -60,14 +60,14 @@ public class ResponseFactory { @Inject public ResponseFactory( - VersionCheckSystem versionCheckSystem, + VersionChecker versionChecker, PlanFiles files, PageFactory pageFactory, Locale locale, DBSystem dbSystem, Theme theme ) { - this.versionCheckSystem = versionCheckSystem; + this.versionChecker = versionChecker; this.files = files; this.pageFactory = pageFactory; this.locale = locale; diff --git a/Plan/common/src/main/java/com/djrapitops/plan/settings/locale/Locale.java b/Plan/common/src/main/java/com/djrapitops/plan/settings/locale/Locale.java index 314fdc185..6440f4879 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/settings/locale/Locale.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/settings/locale/Locale.java @@ -102,6 +102,7 @@ public class Locale extends HashMap { this.langCode = locale.langCode; } + // TODO Use inside Page implementations public String replaceLanguageInHtml(String from) { if (isEmpty()) { return from; diff --git a/Plan/common/src/main/java/com/djrapitops/plan/version/VersionCheckSystem.java b/Plan/common/src/main/java/com/djrapitops/plan/version/VersionChecker.java similarity index 98% rename from Plan/common/src/main/java/com/djrapitops/plan/version/VersionCheckSystem.java rename to Plan/common/src/main/java/com/djrapitops/plan/version/VersionChecker.java index d07397822..7e4b0ab7a 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/version/VersionCheckSystem.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/version/VersionChecker.java @@ -39,7 +39,7 @@ import java.util.Optional; * @author Rsl1122 */ @Singleton -public class VersionCheckSystem implements SubSystem { +public class VersionChecker implements SubSystem { private final String currentVersion; private final Locale locale; @@ -49,7 +49,7 @@ public class VersionCheckSystem implements SubSystem { private VersionInfo newVersionAvailable; @Inject - public VersionCheckSystem( + public VersionChecker( @Named("currentVersion") String currentVersion, Locale locale, PlanConfig config,