Rename VersionCheckSystem -> VersionChecker

This commit is contained in:
Rsl1122 2020-03-02 13:43:30 +02:00 committed by Risto Lahtela
parent b5d07de18b
commit a8126f6669
15 changed files with 88 additions and 81 deletions

View File

@ -23,7 +23,7 @@ import com.djrapitops.plan.delivery.formatting.Formatters;
import com.djrapitops.plan.identification.ServerInfo; import com.djrapitops.plan.identification.ServerInfo;
import com.djrapitops.plan.settings.config.PlanConfig; import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.storage.database.DBSystem; 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.L;
import com.djrapitops.plugin.logging.error.ErrorHandler; import com.djrapitops.plugin.logging.error.ErrorHandler;
import me.clip.placeholderapi.expansion.PlaceholderExpansion; import me.clip.placeholderapi.expansion.PlaceholderExpansion;
@ -54,13 +54,13 @@ public class PlanPlaceHolders extends PlaceholderExpansion {
public final ErrorHandler errorHandler; public final ErrorHandler errorHandler;
private final Collection<AbstractPlanPlaceHolder> placeholders = new ArrayList<>(); private final Collection<AbstractPlanPlaceHolder> placeholders = new ArrayList<>();
private final VersionCheckSystem versionCheckSystem; private final VersionChecker versionChecker;
public PlanPlaceHolders( public PlanPlaceHolders(
PlanSystem system, PlanSystem system,
ErrorHandler errorHandler ErrorHandler errorHandler
) { ) {
this.versionCheckSystem = system.getVersionCheckSystem(); this.versionChecker = system.getVersionChecker();
this.errorHandler = errorHandler; this.errorHandler = errorHandler;
PlanConfig config = system.getConfigSystem().getConfig(); PlanConfig config = system.getConfigSystem().getConfig();
@ -90,6 +90,7 @@ public class PlanPlaceHolders extends PlaceholderExpansion {
return "plan"; return "plan";
} }
@SuppressWarnings("deprecation")
@Override @Override
public String getPlugin() { public String getPlugin() {
return "Plan"; return "Plan";
@ -102,7 +103,7 @@ public class PlanPlaceHolders extends PlaceholderExpansion {
@Override @Override
public String getVersion() { public String getVersion() {
return versionCheckSystem.getCurrentVersion(); return versionChecker.getCurrentVersion();
} }
@Override @Override

View File

@ -40,7 +40,7 @@ import com.djrapitops.plan.settings.locale.LocaleSystem;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.queries.objects.ServerQueries; import com.djrapitops.plan.storage.database.queries.objects.ServerQueries;
import com.djrapitops.plan.storage.file.PlanFiles; 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.Benchmark;
import com.djrapitops.plugin.benchmarking.Timings; import com.djrapitops.plugin.benchmarking.Timings;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
@ -64,7 +64,7 @@ public class PlanSystem implements SubSystem {
private final PlanFiles files; private final PlanFiles files;
private final ConfigSystem configSystem; private final ConfigSystem configSystem;
private final VersionCheckSystem versionCheckSystem; private final VersionChecker versionChecker;
private final LocaleSystem localeSystem; private final LocaleSystem localeSystem;
private final DBSystem databaseSystem; private final DBSystem databaseSystem;
private final CacheSystem cacheSystem; private final CacheSystem cacheSystem;
@ -90,7 +90,7 @@ public class PlanSystem implements SubSystem {
public PlanSystem( public PlanSystem(
PlanFiles files, PlanFiles files,
ConfigSystem configSystem, ConfigSystem configSystem,
VersionCheckSystem versionCheckSystem, VersionChecker versionChecker,
LocaleSystem localeSystem, LocaleSystem localeSystem,
DBSystem databaseSystem, DBSystem databaseSystem,
CacheSystem cacheSystem, CacheSystem cacheSystem,
@ -113,7 +113,7 @@ public class PlanSystem implements SubSystem {
) { ) {
this.files = files; this.files = files;
this.configSystem = configSystem; this.configSystem = configSystem;
this.versionCheckSystem = versionCheckSystem; this.versionChecker = versionChecker;
this.localeSystem = localeSystem; this.localeSystem = localeSystem;
this.databaseSystem = databaseSystem; this.databaseSystem = databaseSystem;
this.cacheSystem = cacheSystem; this.cacheSystem = cacheSystem;
@ -138,7 +138,7 @@ public class PlanSystem implements SubSystem {
"§2 ██▌", "§2 ██▌",
"§2 ██▌ ██▌", "§2 ██▌ ██▌",
"§2 ██▌██▌██▌██▌ §2Player Analytics", "§2 ██▌██▌██▌██▌ §2Player Analytics",
"§2 ██▌██▌██▌██▌ §fv" + versionCheckSystem.getCurrentVersion(), "§2 ██▌██▌██▌██▌ §fv" + versionChecker.getCurrentVersion(),
"" ""
); );
} }
@ -166,7 +166,7 @@ public class PlanSystem implements SubSystem {
files, files,
configSystem, configSystem,
localeSystem, localeSystem,
versionCheckSystem, versionChecker,
databaseSystem, databaseSystem,
webServerSystem, webServerSystem,
processing, processing,
@ -217,7 +217,7 @@ public class PlanSystem implements SubSystem {
localeSystem, localeSystem,
configSystem, configSystem,
files, files,
versionCheckSystem versionChecker
); );
} }
@ -235,8 +235,8 @@ public class PlanSystem implements SubSystem {
// Accessor methods. // Accessor methods.
public VersionCheckSystem getVersionCheckSystem() { public VersionChecker getVersionChecker() {
return versionCheckSystem; return versionChecker;
} }
public ConfigSystem getConfigSystem() { public ConfigSystem getConfigSystem() {

View File

@ -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.DBSystem;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.queries.objects.ServerQueries; 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.CommandNode;
import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandType;
import com.djrapitops.plugin.command.Sender; import com.djrapitops.plugin.command.Sender;
@ -42,21 +42,21 @@ public class InfoCommand extends CommandNode {
private final PlanPlugin plugin; private final PlanPlugin plugin;
private final Locale locale; private final Locale locale;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final VersionCheckSystem versionCheckSystem; private final VersionChecker versionChecker;
@Inject @Inject
public InfoCommand( public InfoCommand(
PlanPlugin plugin, PlanPlugin plugin,
Locale locale, Locale locale,
DBSystem dbSystem, DBSystem dbSystem,
VersionCheckSystem versionCheckSystem VersionChecker versionChecker
) { ) {
super("info", Permissions.INFO.getPermission(), CommandType.CONSOLE); super("info", Permissions.INFO.getPermission(), CommandType.CONSOLE);
this.plugin = plugin; this.plugin = plugin;
this.locale = locale; this.locale = locale;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.versionCheckSystem = versionCheckSystem; this.versionChecker = versionChecker;
setShortHelp(locale.get(CmdHelpLang.INFO).toString()); setShortHelp(locale.get(CmdHelpLang.INFO).toString());
} }
@ -68,7 +68,7 @@ public class InfoCommand extends CommandNode {
Database database = dbSystem.getDatabase(); 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; String proxyAvailable = database.query(ServerQueries.fetchProxyServerInformation()).isPresent() ? yes : no;

View File

@ -24,6 +24,8 @@ import java.util.Objects;
* Object containing webserver security user information. * Object containing webserver security user information.
* *
* @author Rsl1122 * @author Rsl1122
*
* TODO Rewrite Authentication stuff
*/ */
@Deprecated @Deprecated
public class WebUser { public class WebUser {

View File

@ -32,7 +32,7 @@ import com.djrapitops.plan.identification.properties.ServerProperties;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.file.FileResource; import com.djrapitops.plan.storage.file.FileResource;
import com.djrapitops.plan.storage.file.ResourceCache; 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.Benchmark;
import com.djrapitops.plugin.benchmarking.Timings; import com.djrapitops.plugin.benchmarking.Timings;
import com.djrapitops.plugin.logging.FolderTimeStampFileLogger; import com.djrapitops.plugin.logging.FolderTimeStampFileLogger;
@ -57,7 +57,7 @@ public class DebugPage implements Page {
private final String template; private final String template;
private final Database database; private final Database database;
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
private final VersionCheckSystem versionCheckSystem; private final VersionChecker versionChecker;
private final CombineDebugLogger debugLogger; private final CombineDebugLogger debugLogger;
private final Timings timings; private final Timings timings;
private final ErrorHandler errorHandler; private final ErrorHandler errorHandler;
@ -70,7 +70,7 @@ public class DebugPage implements Page {
Database database, Database database,
ServerInfo serverInfo, ServerInfo serverInfo,
Formatters formatters, Formatters formatters,
VersionCheckSystem versionCheckSystem, VersionChecker versionChecker,
DebugLogger debugLogger, DebugLogger debugLogger,
Timings timings, Timings timings,
ErrorHandler errorHandler ErrorHandler errorHandler
@ -79,7 +79,7 @@ public class DebugPage implements Page {
this.database = database; this.database = database;
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
this.versionCheckSystem = versionCheckSystem; this.versionChecker = versionChecker;
this.debugLogger = (CombineDebugLogger) debugLogger; this.debugLogger = (CombineDebugLogger) debugLogger;
this.timings = timings; this.timings = timings;
this.errorHandler = errorHandler; this.errorHandler = errorHandler;
@ -93,8 +93,8 @@ public class DebugPage implements Page {
placeholders.put("title", Icon.called("bug") + " Debug Information"); placeholders.put("title", Icon.called("bug") + " Debug Information");
placeholders.put("titleText", "Debug Information"); placeholders.put("titleText", "Debug Information");
placeholders.put("paragraph", createContent()); placeholders.put("paragraph", createContent());
placeholders.put("version", versionCheckSystem.getUpdateButton().orElse(versionCheckSystem.getCurrentVersionButton())); placeholders.put("version", versionChecker.getUpdateButton().orElse(versionChecker.getCurrentVersionButton()));
placeholders.put("updateModal", versionCheckSystem.getUpdateModal()); placeholders.put("updateModal", versionChecker.getUpdateModal());
placeholders.put("contributors", Contributors.generateContributorHtml()); placeholders.put("contributors", Contributors.generateContributorHtml());
return placeholders.apply(template); return placeholders.apply(template);
} }
@ -207,7 +207,7 @@ public class DebugPage implements Page {
content.append("<pre>### Server Information<br>") content.append("<pre>### Server Information<br>")
.append("**Plan Version:** ") .append("**Plan Version:** ")
.append(versionCheckSystem.getCurrentVersion()) .append(versionChecker.getCurrentVersion())
.append("<br>"); .append("<br>");
content.append("**Server:** "); content.append("**Server:** ");

View File

@ -19,7 +19,7 @@ package com.djrapitops.plan.delivery.rendering.pages;
import com.djrapitops.plan.delivery.formatting.PlaceholderReplacer; import com.djrapitops.plan.delivery.formatting.PlaceholderReplacer;
import com.djrapitops.plan.delivery.rendering.html.Contributors; import com.djrapitops.plan.delivery.rendering.html.Contributors;
import com.djrapitops.plan.delivery.rendering.html.icon.Icon; 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. * Page to display error stacktrace.
@ -33,24 +33,24 @@ public class ErrorMessagePage implements Page {
private final String errorTitle; private final String errorTitle;
private final String errorMsg; private final String errorMsg;
private final VersionCheckSystem versionCheckSystem; private final VersionChecker versionChecker;
public ErrorMessagePage( public ErrorMessagePage(
String template, Icon icon, String errorTitle, String errorMsg, String template, Icon icon, String errorTitle, String errorMsg,
VersionCheckSystem versionCheckSystem VersionChecker versionChecker
) { ) {
this.template = template; this.template = template;
this.icon = icon; this.icon = icon;
this.errorTitle = errorTitle; this.errorTitle = errorTitle;
this.errorMsg = errorMsg; this.errorMsg = errorMsg;
this.versionCheckSystem = versionCheckSystem; this.versionChecker = versionChecker;
} }
public ErrorMessagePage( public ErrorMessagePage(
String template, String errorTitle, String errorMsg, 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 @Override
@ -60,8 +60,8 @@ public class ErrorMessagePage implements Page {
placeholders.put("title", icon.toHtml() + " " + errorTitle); placeholders.put("title", icon.toHtml() + " " + errorTitle);
placeholders.put("titleText", errorTitle); placeholders.put("titleText", errorTitle);
placeholders.put("paragraph", errorMsg); placeholders.put("paragraph", errorMsg);
placeholders.put("version", versionCheckSystem.getUpdateButton().orElse(versionCheckSystem.getCurrentVersionButton())); placeholders.put("version", versionChecker.getUpdateButton().orElse(versionChecker.getCurrentVersionButton()));
placeholders.put("updateModal", versionCheckSystem.getUpdateModal()); placeholders.put("updateModal", versionChecker.getUpdateModal());
placeholders.put("contributors", Contributors.generateContributorHtml()); placeholders.put("contributors", Contributors.generateContributorHtml());
return placeholders.apply(template); return placeholders.apply(template);
} }

View File

@ -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.Contributors;
import com.djrapitops.plan.delivery.rendering.html.Html; import com.djrapitops.plan.delivery.rendering.html.Html;
import com.djrapitops.plan.delivery.rendering.html.icon.Icon; 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. * Page to display error stacktrace.
@ -33,16 +33,16 @@ public class InternalErrorPage implements Page {
private final String errorMsg; private final String errorMsg;
private final Throwable error; private final Throwable error;
private final VersionCheckSystem versionCheckSystem; private final VersionChecker versionChecker;
public InternalErrorPage( public InternalErrorPage(
String template, String errorMsg, Throwable error, String template, String errorMsg, Throwable error,
VersionCheckSystem versionCheckSystem VersionChecker versionChecker
) { ) {
this.template = template; this.template = template;
this.errorMsg = errorMsg; this.errorMsg = errorMsg;
this.error = error; this.error = error;
this.versionCheckSystem = versionCheckSystem; this.versionChecker = versionChecker;
} }
@Override @Override
@ -52,8 +52,8 @@ public class InternalErrorPage implements Page {
placeholders.put("title", Icon.called("bug") + " 500 Internal Error occurred"); placeholders.put("title", Icon.called("bug") + " 500 Internal Error occurred");
placeholders.put("titleText", "500 Internal Error occurred"); placeholders.put("titleText", "500 Internal Error occurred");
placeholders.put("paragraph", createContent()); placeholders.put("paragraph", createContent());
placeholders.put("version", versionCheckSystem.getUpdateButton().orElse(versionCheckSystem.getCurrentVersionButton())); placeholders.put("version", versionChecker.getUpdateButton().orElse(versionChecker.getCurrentVersionButton()));
placeholders.put("updateModal", versionCheckSystem.getUpdateModal()); placeholders.put("updateModal", versionChecker.getUpdateModal());
placeholders.put("contributors", Contributors.generateContributorHtml()); placeholders.put("contributors", Contributors.generateContributorHtml());
return placeholders.apply(template); return placeholders.apply(template);
} }

View File

@ -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.Theme;
import com.djrapitops.plan.settings.theme.ThemeVal; import com.djrapitops.plan.settings.theme.ThemeVal;
import com.djrapitops.plan.storage.database.DBSystem; 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 org.apache.commons.lang3.StringUtils;
import java.util.List; import java.util.List;
@ -46,7 +46,7 @@ public class NetworkPage implements Page {
private final String templateHtml; private final String templateHtml;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final VersionCheckSystem versionCheckSystem; private final VersionChecker versionChecker;
private final PlanConfig config; private final PlanConfig config;
private final Theme theme; private final Theme theme;
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
@ -56,7 +56,7 @@ public class NetworkPage implements Page {
String templateHtml, String templateHtml,
DBSystem dbSystem, DBSystem dbSystem,
VersionCheckSystem versionCheckSystem, VersionChecker versionChecker,
PlanConfig config, PlanConfig config,
Theme theme, Theme theme,
ServerInfo serverInfo, ServerInfo serverInfo,
@ -64,7 +64,7 @@ public class NetworkPage implements Page {
) { ) {
this.templateHtml = templateHtml; this.templateHtml = templateHtml;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.versionCheckSystem = versionCheckSystem; this.versionChecker = versionChecker;
this.config = config; this.config = config;
this.theme = theme; this.theme = theme;
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
@ -89,8 +89,8 @@ public class NetworkPage implements Page {
placeholders.put("avgPingColor", theme.getValue(ThemeVal.GRAPH_AVG_PING)); placeholders.put("avgPingColor", theme.getValue(ThemeVal.GRAPH_AVG_PING));
placeholders.put("timeZone", config.getTimeZoneOffsetHours()); placeholders.put("timeZone", config.getTimeZoneOffsetHours());
placeholders.put("version", versionCheckSystem.getUpdateButton().orElse(versionCheckSystem.getCurrentVersionButton())); placeholders.put("version", versionChecker.getUpdateButton().orElse(versionChecker.getCurrentVersionButton()));
placeholders.put("updateModal", versionCheckSystem.getUpdateModal()); placeholders.put("updateModal", versionChecker.getUpdateModal());
placeholders.put("contributors", Contributors.generateContributorHtml()); placeholders.put("contributors", Contributors.generateContributorHtml());
CachingSupplier<ServerPluginTabs> pluginTabs = new CachingSupplier<>(() -> { CachingSupplier<ServerPluginTabs> pluginTabs = new CachingSupplier<>(() -> {

View File

@ -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.containers.ContainerFetchQueries;
import com.djrapitops.plan.storage.database.queries.objects.ServerQueries; import com.djrapitops.plan.storage.database.queries.objects.ServerQueries;
import com.djrapitops.plan.storage.file.PlanFiles; 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.benchmarking.Timings;
import com.djrapitops.plugin.logging.debug.DebugLogger; import com.djrapitops.plugin.logging.debug.DebugLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler; import com.djrapitops.plugin.logging.error.ErrorHandler;
@ -52,9 +52,10 @@ import java.util.*;
@Singleton @Singleton
public class PageFactory { public class PageFactory {
private final Lazy<VersionCheckSystem> versionCheckSystem; private final Lazy<VersionChecker> versionChecker;
private final Lazy<PlanFiles> files; private final Lazy<PlanFiles> files;
private final Lazy<PlanConfig> config; private final Lazy<PlanConfig> config;
private final Lazy<Locale> locale;
private final Lazy<Theme> theme; private final Lazy<Theme> theme;
private final Lazy<DBSystem> dbSystem; private final Lazy<DBSystem> dbSystem;
private final Lazy<ServerInfo> serverInfo; private final Lazy<ServerInfo> serverInfo;
@ -65,9 +66,10 @@ public class PageFactory {
@Inject @Inject
public PageFactory( public PageFactory(
Lazy<VersionCheckSystem> versionCheckSystem, Lazy<VersionChecker> versionChecker,
Lazy<PlanFiles> files, Lazy<PlanFiles> files,
Lazy<PlanConfig> config, Lazy<PlanConfig> config,
Lazy<Locale> locale,
Lazy<Theme> theme, Lazy<Theme> theme,
Lazy<DBSystem> dbSystem, Lazy<DBSystem> dbSystem,
Lazy<ServerInfo> serverInfo, Lazy<ServerInfo> serverInfo,
@ -76,9 +78,10 @@ public class PageFactory {
Lazy<Timings> timings, Lazy<Timings> timings,
Lazy<ErrorHandler> errorHandler Lazy<ErrorHandler> errorHandler
) { ) {
this.versionCheckSystem = versionCheckSystem; this.versionChecker = versionChecker;
this.files = files; this.files = files;
this.config = config; this.config = config;
this.locale = locale;
this.theme = theme; this.theme = theme;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
@ -91,13 +94,13 @@ public class PageFactory {
public DebugPage debugPage() throws IOException { public DebugPage debugPage() throws IOException {
return new DebugPage( return new DebugPage(
getResource("web/error.html"), 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() debugLogger.get(), timings.get(), errorHandler.get()
); );
} }
public PlayersPage playersPage() throws IOException { 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 { public ServerPage serverPage(UUID serverUUID) throws NotFoundException, IOException {
@ -108,7 +111,7 @@ public class PageFactory {
server, server,
config.get(), config.get(),
theme.get(), theme.get(),
versionCheckSystem.get(), versionChecker.get(),
dbSystem.get(), dbSystem.get(),
serverInfo.get(), serverInfo.get(),
formatters.get() formatters.get()
@ -120,7 +123,7 @@ public class PageFactory {
PlayerContainer player = db.query(ContainerFetchQueries.fetchPlayerContainer(playerUUID)); PlayerContainer player = db.query(ContainerFetchQueries.fetchPlayerContainer(playerUUID));
return new PlayerPage( return new PlayerPage(
getResource("web/player.html"), player, getResource("web/player.html"), player,
versionCheckSystem.get(), versionChecker.get(),
config.get(), this, theme.get(), config.get(), this, theme.get(),
formatters.get(), serverInfo.get() formatters.get(), serverInfo.get()
); );
@ -162,14 +165,14 @@ public class PageFactory {
public NetworkPage networkPage() throws IOException { public NetworkPage networkPage() throws IOException {
return new NetworkPage(getResource("web/network.html"), return new NetworkPage(getResource("web/network.html"),
dbSystem.get(), 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) { public Page internalErrorPage(String message, Throwable error) {
try { try {
return new InternalErrorPage( return new InternalErrorPage(
getResource("web/error.html"), message, error, getResource("web/error.html"), message, error,
versionCheckSystem.get()); versionChecker.get());
} catch (IOException noParse) { } catch (IOException noParse) {
return () -> "Error occurred: " + error.toString() + return () -> "Error occurred: " + error.toString() +
", additional error occurred when attempting to render error page to user: " + ", 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 { public Page errorPage(String title, String error) throws IOException {
return new ErrorMessagePage( return new ErrorMessagePage(
getResource("web/error.html"), title, error, getResource("web/error.html"), title, error,
versionCheckSystem.get()); versionChecker.get());
} }
public Page errorPage(Icon icon, String title, String error) throws IOException { public Page errorPage(Icon icon, String title, String error) throws IOException {
return new ErrorMessagePage( return new ErrorMessagePage(
getResource("web/error.html"), icon, title, error, getResource("web/error.html"), icon, title, error,
versionCheckSystem.get()); versionChecker.get());
} }
public String getResource(String name) throws IOException { public String getResource(String name) throws IOException {

View File

@ -27,7 +27,7 @@ import com.djrapitops.plan.identification.ServerInfo;
import com.djrapitops.plan.settings.config.PlanConfig; import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.settings.theme.Theme; import com.djrapitops.plan.settings.theme.Theme;
import com.djrapitops.plan.settings.theme.ThemeVal; import com.djrapitops.plan.settings.theme.ThemeVal;
import com.djrapitops.plan.version.VersionCheckSystem; import com.djrapitops.plan.version.VersionChecker;
import java.util.UUID; import java.util.UUID;
@ -41,7 +41,7 @@ public class PlayerPage implements Page {
private final String templateHtml; private final String templateHtml;
private final PlayerContainer player; private final PlayerContainer player;
private final VersionCheckSystem versionCheckSystem; private final VersionChecker versionChecker;
private final PlanConfig config; private final PlanConfig config;
private final PageFactory pageFactory; private final PageFactory pageFactory;
@ -54,7 +54,7 @@ public class PlayerPage implements Page {
PlayerPage( PlayerPage(
String templateHtml, String templateHtml,
PlayerContainer player, PlayerContainer player,
VersionCheckSystem versionCheckSystem, VersionChecker versionChecker,
PlanConfig config, PlanConfig config,
PageFactory pageFactory, PageFactory pageFactory,
Theme theme, Theme theme,
@ -63,7 +63,7 @@ public class PlayerPage implements Page {
) { ) {
this.templateHtml = templateHtml; this.templateHtml = templateHtml;
this.player = player; this.player = player;
this.versionCheckSystem = versionCheckSystem; this.versionChecker = versionChecker;
this.config = config; this.config = config;
this.pageFactory = pageFactory; this.pageFactory = pageFactory;
this.theme = theme; this.theme = theme;
@ -89,8 +89,8 @@ public class PlayerPage implements Page {
placeholders.put("refresh", clockLongFormatter.apply(now)); placeholders.put("refresh", clockLongFormatter.apply(now));
placeholders.put("refreshFull", secondLongFormatter.apply(now)); placeholders.put("refreshFull", secondLongFormatter.apply(now));
placeholders.put("version", versionCheckSystem.getUpdateButton().orElse(versionCheckSystem.getCurrentVersionButton())); placeholders.put("version", versionChecker.getUpdateButton().orElse(versionChecker.getCurrentVersionButton()));
placeholders.put("updateModal", versionCheckSystem.getUpdateModal()); placeholders.put("updateModal", versionChecker.getUpdateModal());
placeholders.put("timeZone", config.getTimeZoneOffsetHours()); placeholders.put("timeZone", config.getTimeZoneOffsetHours());
String playerName = player.getValue(PlayerKeys.NAME).orElse(playerUUID.toString()); String playerName = player.getValue(PlayerKeys.NAME).orElse(playerUUID.toString());

View File

@ -22,7 +22,7 @@ import com.djrapitops.plan.identification.ServerInfo;
import com.djrapitops.plan.settings.config.PlanConfig; import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.settings.config.paths.PluginSettings; import com.djrapitops.plan.settings.config.paths.PluginSettings;
import com.djrapitops.plan.settings.config.paths.ProxySettings; 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. * Html String generator for /players page.
@ -32,18 +32,18 @@ import com.djrapitops.plan.version.VersionCheckSystem;
public class PlayersPage implements Page { public class PlayersPage implements Page {
private final String templateHtml; private final String templateHtml;
private final VersionCheckSystem versionCheckSystem; private final VersionChecker versionChecker;
private final PlanConfig config; private final PlanConfig config;
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
PlayersPage( PlayersPage(
String templateHtml, String templateHtml,
VersionCheckSystem versionCheckSystem, VersionChecker versionChecker,
PlanConfig config, PlanConfig config,
ServerInfo serverInfo ServerInfo serverInfo
) { ) {
this.templateHtml = templateHtml; this.templateHtml = templateHtml;
this.versionCheckSystem = versionCheckSystem; this.versionChecker = versionChecker;
this.config = config; this.config = config;
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
} }
@ -52,8 +52,8 @@ public class PlayersPage implements Page {
public String toHtml() { public String toHtml() {
PlaceholderReplacer placeholders = new PlaceholderReplacer(); PlaceholderReplacer placeholders = new PlaceholderReplacer();
placeholders.put("version", versionCheckSystem.getUpdateButton().orElse(versionCheckSystem.getCurrentVersionButton())); placeholders.put("version", versionChecker.getUpdateButton().orElse(versionChecker.getCurrentVersionButton()));
placeholders.put("updateModal", versionCheckSystem.getUpdateModal()); placeholders.put("updateModal", versionChecker.getUpdateModal());
placeholders.put("contributors", Contributors.generateContributorHtml()); placeholders.put("contributors", Contributors.generateContributorHtml());
if (serverInfo.getServer().isProxy()) { if (serverInfo.getServer().isProxy()) {
placeholders.put("networkName", config.get(ProxySettings.NETWORK_NAME)); placeholders.put("networkName", config.get(ProxySettings.NETWORK_NAME));

View File

@ -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.Theme;
import com.djrapitops.plan.settings.theme.ThemeVal; import com.djrapitops.plan.settings.theme.ThemeVal;
import com.djrapitops.plan.storage.database.DBSystem; 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.List;
import java.util.UUID; import java.util.UUID;
@ -53,7 +53,7 @@ public class ServerPage implements Page {
private final Server server; private final Server server;
private final PlanConfig config; private final PlanConfig config;
private final Theme theme; private final Theme theme;
private final VersionCheckSystem versionCheckSystem; private final VersionChecker versionChecker;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
private final Formatters formatters; private final Formatters formatters;
@ -62,7 +62,7 @@ public class ServerPage implements Page {
String templateHtml, Server server, String templateHtml, Server server,
PlanConfig config, PlanConfig config,
Theme theme, Theme theme,
VersionCheckSystem versionCheckSystem, VersionChecker versionChecker,
DBSystem dbSystem, DBSystem dbSystem,
ServerInfo serverInfo, ServerInfo serverInfo,
Formatters formatters Formatters formatters
@ -71,7 +71,7 @@ public class ServerPage implements Page {
this.server = server; this.server = server;
this.config = config; this.config = config;
this.theme = theme; this.theme = theme;
this.versionCheckSystem = versionCheckSystem; this.versionChecker = versionChecker;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
this.formatters = formatters; 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("backButton", serverInfo.getServer().isProxy() ? Html.BACK_BUTTON_NETWORK.create() : "");
placeholders.put("contributors", Contributors.generateContributorHtml()); placeholders.put("contributors", Contributors.generateContributorHtml());
placeholders.put("version", versionCheckSystem.getUpdateButton().orElse(versionCheckSystem.getCurrentVersionButton())); placeholders.put("version", versionChecker.getUpdateButton().orElse(versionChecker.getCurrentVersionButton()));
placeholders.put("updateModal", versionCheckSystem.getUpdateModal()); placeholders.put("updateModal", versionChecker.getUpdateModal());
CachingSupplier<ServerPluginTabs> pluginTabs = new CachingSupplier<>(() -> { CachingSupplier<ServerPluginTabs> pluginTabs = new CachingSupplier<>(() -> {
List<ExtensionData> extensionData = dbSystem.getDatabase().query(new ExtensionServerDataQuery(serverUUID)); List<ExtensionData> extensionData = dbSystem.getDatabase().query(new ExtensionServerDataQuery(serverUUID));

View File

@ -33,7 +33,7 @@ import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.queries.containers.ContainerFetchQueries; import com.djrapitops.plan.storage.database.queries.containers.ContainerFetchQueries;
import com.djrapitops.plan.storage.file.PlanFiles; 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.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -51,7 +51,7 @@ import java.util.UUID;
@Singleton @Singleton
public class ResponseFactory { public class ResponseFactory {
private final VersionCheckSystem versionCheckSystem; private final VersionChecker versionChecker;
private final PlanFiles files; private final PlanFiles files;
private final PageFactory pageFactory; private final PageFactory pageFactory;
private final Locale locale; private final Locale locale;
@ -60,14 +60,14 @@ public class ResponseFactory {
@Inject @Inject
public ResponseFactory( public ResponseFactory(
VersionCheckSystem versionCheckSystem, VersionChecker versionChecker,
PlanFiles files, PlanFiles files,
PageFactory pageFactory, PageFactory pageFactory,
Locale locale, Locale locale,
DBSystem dbSystem, DBSystem dbSystem,
Theme theme Theme theme
) { ) {
this.versionCheckSystem = versionCheckSystem; this.versionChecker = versionChecker;
this.files = files; this.files = files;
this.pageFactory = pageFactory; this.pageFactory = pageFactory;
this.locale = locale; this.locale = locale;

View File

@ -102,6 +102,7 @@ public class Locale extends HashMap<Lang, Message> {
this.langCode = locale.langCode; this.langCode = locale.langCode;
} }
// TODO Use inside Page implementations
public String replaceLanguageInHtml(String from) { public String replaceLanguageInHtml(String from) {
if (isEmpty()) { if (isEmpty()) {
return from; return from;

View File

@ -39,7 +39,7 @@ import java.util.Optional;
* @author Rsl1122 * @author Rsl1122
*/ */
@Singleton @Singleton
public class VersionCheckSystem implements SubSystem { public class VersionChecker implements SubSystem {
private final String currentVersion; private final String currentVersion;
private final Locale locale; private final Locale locale;
@ -49,7 +49,7 @@ public class VersionCheckSystem implements SubSystem {
private VersionInfo newVersionAvailable; private VersionInfo newVersionAvailable;
@Inject @Inject
public VersionCheckSystem( public VersionChecker(
@Named("currentVersion") String currentVersion, @Named("currentVersion") String currentVersion,
Locale locale, Locale locale,
PlanConfig config, PlanConfig config,