mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-08 09:27:45 +01:00
[Debt] Added PlanFiles to FileResponse constructor
ResponseFactory provides the Response objects this dependency. Renamed all occurrences of "planFiles" -> "files"
This commit is contained in:
parent
9b9443adf4
commit
aeec459ee9
@ -35,7 +35,7 @@ public class ManageRestoreCommand extends CommandNode {
|
||||
private final DBSystem dbSystem;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final SQLiteDB.Factory sqliteFactory;
|
||||
private final PlanFiles planFiles;
|
||||
private final PlanFiles files;
|
||||
|
||||
@Inject
|
||||
public ManageRestoreCommand(
|
||||
@ -43,7 +43,7 @@ public class ManageRestoreCommand extends CommandNode {
|
||||
Processing processing,
|
||||
DBSystem dbSystem,
|
||||
SQLiteDB.Factory sqliteFactory,
|
||||
PlanFiles planFiles,
|
||||
PlanFiles files,
|
||||
ErrorHandler errorHandler
|
||||
) {
|
||||
super("restore", Permissions.MANAGE.getPermission(), CommandType.CONSOLE);
|
||||
@ -52,7 +52,7 @@ public class ManageRestoreCommand extends CommandNode {
|
||||
this.processing = processing;
|
||||
this.dbSystem = dbSystem;
|
||||
this.sqliteFactory = sqliteFactory;
|
||||
this.planFiles = planFiles;
|
||||
this.files = files;
|
||||
this.errorHandler = errorHandler;
|
||||
|
||||
setArguments("<Filename.db>", "<dbTo>", "[-a]");
|
||||
@ -96,7 +96,7 @@ public class ManageRestoreCommand extends CommandNode {
|
||||
String backupDBName = backupDbName;
|
||||
boolean containsDBFileExtension = backupDBName.endsWith(".db");
|
||||
|
||||
File backupDBFile = planFiles.getFileFromPluginFolder(backupDBName + (containsDBFileExtension ? "" : ".db"));
|
||||
File backupDBFile = files.getFileFromPluginFolder(backupDBName + (containsDBFileExtension ? "" : ".db"));
|
||||
|
||||
if (!backupDBFile.exists()) {
|
||||
sender.sendMessage(locale.getString(ManageLang.FAIL_FILE_NOT_FOUND, backupDBFile.getAbsolutePath()));
|
||||
|
@ -19,8 +19,8 @@ public class FilesModule {
|
||||
@Provides
|
||||
@Named("configFile")
|
||||
@Singleton
|
||||
File provideConfigFile(PlanFiles planFiles) {
|
||||
return planFiles.getConfigFile();
|
||||
File provideConfigFile(PlanFiles files) {
|
||||
return files.getConfigFile();
|
||||
}
|
||||
|
||||
}
|
@ -38,7 +38,7 @@ import javax.inject.Singleton;
|
||||
@Singleton
|
||||
public class PlanSystem implements SubSystem {
|
||||
|
||||
private final PlanFiles planFiles;
|
||||
private final PlanFiles files;
|
||||
private final ConfigSystem configSystem;
|
||||
private final VersionCheckSystem versionCheckSystem;
|
||||
private final LocaleSystem localeSystem;
|
||||
@ -60,7 +60,7 @@ public class PlanSystem implements SubSystem {
|
||||
|
||||
@Inject
|
||||
public PlanSystem(
|
||||
PlanFiles planFiles,
|
||||
PlanFiles files,
|
||||
ConfigSystem configSystem,
|
||||
VersionCheckSystem versionCheckSystem,
|
||||
LocaleSystem localeSystem,
|
||||
@ -78,7 +78,7 @@ public class PlanSystem implements SubSystem {
|
||||
PlanAPI planAPI,
|
||||
ErrorHandler errorHandler
|
||||
) {
|
||||
this.planFiles = planFiles;
|
||||
this.files = files;
|
||||
this.configSystem = configSystem;
|
||||
this.versionCheckSystem = versionCheckSystem;
|
||||
this.localeSystem = localeSystem;
|
||||
@ -105,7 +105,7 @@ public class PlanSystem implements SubSystem {
|
||||
@Override
|
||||
public void enable() throws EnableException {
|
||||
enableSystems(
|
||||
planFiles,
|
||||
files,
|
||||
configSystem,
|
||||
localeSystem,
|
||||
versionCheckSystem,
|
||||
@ -143,7 +143,7 @@ public class PlanSystem implements SubSystem {
|
||||
serverInfo,
|
||||
localeSystem,
|
||||
configSystem,
|
||||
planFiles,
|
||||
files,
|
||||
versionCheckSystem
|
||||
);
|
||||
}
|
||||
@ -171,7 +171,7 @@ public class PlanSystem implements SubSystem {
|
||||
}
|
||||
|
||||
public PlanFiles getPlanFiles() {
|
||||
return planFiles;
|
||||
return files;
|
||||
}
|
||||
|
||||
public DBSystem getDatabaseSystem() {
|
||||
|
@ -40,7 +40,7 @@ import java.util.zip.GZIPInputStream;
|
||||
public class GeolocationCache implements SubSystem {
|
||||
|
||||
private final Locale locale;
|
||||
private final PlanFiles planFiles;
|
||||
private final PlanFiles files;
|
||||
private final PlanConfig config;
|
||||
private final PluginLogger logger;
|
||||
private final Map<String, String> cached;
|
||||
@ -50,12 +50,12 @@ public class GeolocationCache implements SubSystem {
|
||||
@Inject
|
||||
public GeolocationCache(
|
||||
Locale locale,
|
||||
PlanFiles planFiles,
|
||||
PlanFiles files,
|
||||
PlanConfig config,
|
||||
PluginLogger logger
|
||||
) {
|
||||
this.locale = locale;
|
||||
this.planFiles = planFiles;
|
||||
this.files = files;
|
||||
this.config = config;
|
||||
this.logger = logger;
|
||||
|
||||
@ -64,7 +64,7 @@ public class GeolocationCache implements SubSystem {
|
||||
|
||||
@Override
|
||||
public void enable() throws EnableException {
|
||||
geolocationDB = planFiles.getFileFromPluginFolder("GeoIP.dat");
|
||||
geolocationDB = files.getFileFromPluginFolder("GeoIP.dat");
|
||||
if (config.isTrue(Settings.DATA_GEOLOCATIONS)) {
|
||||
try {
|
||||
checkDB();
|
||||
|
@ -187,13 +187,13 @@ public class SQLiteDB extends SQLDB {
|
||||
private final PluginLogger logger;
|
||||
private final Timings timings;
|
||||
private final ErrorHandler errorHandler;
|
||||
private PlanFiles planFiles;
|
||||
private PlanFiles files;
|
||||
|
||||
@Inject
|
||||
public Factory(
|
||||
Locale locale,
|
||||
PlanConfig config,
|
||||
PlanFiles planFiles,
|
||||
PlanFiles files,
|
||||
Lazy<ServerInfo> serverInfo,
|
||||
RunnableFactory runnableFactory,
|
||||
PluginLogger logger,
|
||||
@ -202,7 +202,7 @@ public class SQLiteDB extends SQLDB {
|
||||
) {
|
||||
this.locale = locale;
|
||||
this.config = config;
|
||||
this.planFiles = planFiles;
|
||||
this.files = files;
|
||||
this.serverInfo = serverInfo;
|
||||
this.runnableFactory = runnableFactory;
|
||||
this.logger = logger;
|
||||
@ -215,7 +215,7 @@ public class SQLiteDB extends SQLDB {
|
||||
}
|
||||
|
||||
public SQLiteDB usingFileCalled(String fileName) {
|
||||
return usingFile(planFiles.getFileFromPluginFolder(fileName + ".db"));
|
||||
return usingFile(files.getFileFromPluginFolder(fileName + ".db"));
|
||||
}
|
||||
|
||||
public SQLiteDB usingFile(File databaseFile) {
|
||||
|
@ -23,16 +23,16 @@ import java.util.UUID;
|
||||
*/
|
||||
public class ServerInfoFile extends Config {
|
||||
|
||||
private final PlanFiles planFiles;
|
||||
private final PlanFiles files;
|
||||
|
||||
@Inject
|
||||
public ServerInfoFile(PlanFiles planFiles) {
|
||||
super(planFiles.getFileFromPluginFolder("ServerInfoFile.yml"));
|
||||
this.planFiles = planFiles;
|
||||
public ServerInfoFile(PlanFiles files) {
|
||||
super(files.getFileFromPluginFolder("ServerInfoFile.yml"));
|
||||
this.files = files;
|
||||
}
|
||||
|
||||
public void prepare() throws IOException {
|
||||
copyDefaults(planFiles.readFromResource("DefaultServerInfoFile.yml"));
|
||||
copyDefaults(files.readFromResource("DefaultServerInfoFile.yml"));
|
||||
save();
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ import java.util.stream.Collectors;
|
||||
@Singleton
|
||||
public class LocaleSystem implements SubSystem {
|
||||
|
||||
private final PlanFiles planFiles;
|
||||
private final PlanFiles files;
|
||||
private final PlanConfig config;
|
||||
private final PluginLogger logger;
|
||||
private final ErrorHandler errorHandler;
|
||||
@ -37,12 +37,12 @@ public class LocaleSystem implements SubSystem {
|
||||
|
||||
@Inject
|
||||
public LocaleSystem(
|
||||
PlanFiles planFiles,
|
||||
PlanFiles files,
|
||||
PlanConfig config,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
) {
|
||||
this.planFiles = planFiles;
|
||||
this.files = files;
|
||||
this.config = config;
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
@ -72,7 +72,7 @@ public class LocaleSystem implements SubSystem {
|
||||
|
||||
@Override
|
||||
public void enable() {
|
||||
File localeFile = planFiles.getLocaleFile();
|
||||
File localeFile = files.getLocaleFile();
|
||||
|
||||
if (config.isTrue(Settings.WRITE_NEW_LOCALE)) {
|
||||
writeNewDefaultLocale(localeFile);
|
||||
|
@ -25,17 +25,17 @@ public class BukkitConfigSystem extends ConfigSystem {
|
||||
|
||||
@Inject
|
||||
public BukkitConfigSystem(
|
||||
PlanFiles planFiles,
|
||||
PlanFiles files,
|
||||
PlanConfig config,
|
||||
Theme theme,
|
||||
ErrorHandler errorHandler
|
||||
) {
|
||||
super(planFiles, config, theme, errorHandler);
|
||||
super(files, config, theme, errorHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void copyDefaults() throws IOException {
|
||||
config.copyDefaults(planFiles.readFromResource("config.yml"));
|
||||
config.copyDefaults(files.readFromResource("config.yml"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,17 +25,17 @@ public class BungeeConfigSystem extends ConfigSystem {
|
||||
|
||||
@Inject
|
||||
public BungeeConfigSystem(
|
||||
PlanFiles planFiles,
|
||||
PlanFiles files,
|
||||
PlanConfig config,
|
||||
Theme theme,
|
||||
ErrorHandler errorHandler
|
||||
) {
|
||||
super(planFiles, config, theme, errorHandler);
|
||||
super(files, config, theme, errorHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void copyDefaults() throws IOException {
|
||||
config.copyDefaults(planFiles.readFromResource("bungeeconfig.yml"));
|
||||
config.copyDefaults(files.readFromResource("bungeeconfig.yml"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,18 +24,18 @@ import java.io.IOException;
|
||||
@Singleton
|
||||
public abstract class ConfigSystem implements SubSystem {
|
||||
|
||||
protected final PlanFiles planFiles;
|
||||
protected final PlanFiles files;
|
||||
protected final PlanConfig config;
|
||||
protected final Theme theme;
|
||||
protected final ErrorHandler errorHandler;
|
||||
|
||||
public ConfigSystem(
|
||||
PlanFiles planFiles,
|
||||
PlanFiles files,
|
||||
PlanConfig config,
|
||||
Theme theme,
|
||||
ErrorHandler errorHandler
|
||||
) {
|
||||
this.planFiles = planFiles;
|
||||
this.files = files;
|
||||
this.config = config;
|
||||
this.theme = theme;
|
||||
this.errorHandler = errorHandler;
|
||||
|
@ -25,19 +25,19 @@ public class SpongeConfigSystem extends BukkitConfigSystem {
|
||||
|
||||
@Inject
|
||||
public SpongeConfigSystem(
|
||||
PlanFiles planFiles,
|
||||
PlanFiles files,
|
||||
PlanConfig config,
|
||||
Theme theme,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
) {
|
||||
super(planFiles, config, theme, errorHandler);
|
||||
super(files, config, theme, errorHandler);
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable() throws EnableException {
|
||||
firstInstall = !planFiles.getConfigFile().exists();
|
||||
firstInstall = !files.getConfigFile().exists();
|
||||
super.enable();
|
||||
config.getNetworkSettings().loadSettingsFromDB();
|
||||
}
|
||||
|
@ -27,8 +27,8 @@ import java.util.List;
|
||||
public class ThemeConfig extends Config {
|
||||
|
||||
@Inject
|
||||
public ThemeConfig(PlanFiles planFiles, PlanConfig config, PluginLogger logger) {
|
||||
this(getConfigFile(planFiles), getDefaults(planFiles, config, logger));
|
||||
public ThemeConfig(PlanFiles files, PlanConfig config, PluginLogger logger) {
|
||||
this(getConfigFile(files), getDefaults(files, config, logger));
|
||||
}
|
||||
|
||||
private ThemeConfig(File configFile, List<String> defaults) {
|
||||
@ -43,12 +43,12 @@ public class ThemeConfig extends Config {
|
||||
}
|
||||
}
|
||||
|
||||
private static List<String> getDefaults(PlanFiles planFiles, PlanConfig config, PluginLogger logger) {
|
||||
private static List<String> getDefaults(PlanFiles files, PlanConfig config, PluginLogger logger) {
|
||||
String fileName = config.getString(Settings.THEME_BASE);
|
||||
String fileLocation = getFileLocation(fileName);
|
||||
|
||||
try {
|
||||
return planFiles.readFromResource(fileLocation);
|
||||
return files.readFromResource(fileLocation);
|
||||
} catch (IOException e) {
|
||||
logger.error("Could not find theme " + fileLocation + ". Attempting to use default.");
|
||||
return new ArrayList<>();
|
||||
@ -82,7 +82,7 @@ public class ThemeConfig extends Config {
|
||||
}
|
||||
}
|
||||
|
||||
private static File getConfigFile(PlanFiles planFiles) {
|
||||
return planFiles.getFileFromPluginFolder("theme.yml");
|
||||
private static File getConfigFile(PlanFiles files) {
|
||||
return files.getFileFromPluginFolder("theme.yml");
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ import java.util.concurrent.TimeUnit;
|
||||
public class WebServer implements SubSystem {
|
||||
|
||||
private final Locale locale;
|
||||
private final PlanFiles planFiles;
|
||||
private final PlanFiles files;
|
||||
private final PlanConfig config;
|
||||
|
||||
private final ServerProperties serverProperties;
|
||||
@ -58,7 +58,7 @@ public class WebServer implements SubSystem {
|
||||
@Inject
|
||||
public WebServer(
|
||||
Locale locale,
|
||||
PlanFiles planFiles,
|
||||
PlanFiles files,
|
||||
PlanConfig config,
|
||||
ServerProperties serverProperties,
|
||||
PluginLogger logger,
|
||||
@ -66,7 +66,7 @@ public class WebServer implements SubSystem {
|
||||
RequestHandler requestHandler
|
||||
) {
|
||||
this.locale = locale;
|
||||
this.planFiles = planFiles;
|
||||
this.files = files;
|
||||
this.config = config;
|
||||
this.serverProperties = serverProperties;
|
||||
|
||||
@ -136,7 +136,7 @@ public class WebServer implements SubSystem {
|
||||
private boolean startHttpsServer() {
|
||||
String keyStorePath = config.getString(Settings.WEBSERVER_CERTIFICATE_PATH);
|
||||
if (!Paths.get(keyStorePath).isAbsolute()) {
|
||||
keyStorePath = planFiles.getDataFolder() + File.separator + keyStorePath;
|
||||
keyStorePath = files.getDataFolder() + File.separator + keyStorePath;
|
||||
}
|
||||
|
||||
char[] storepass = config.getString(Settings.WEBSERVER_CERTIFICATE_STOREPASS).toCharArray();
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.djrapitops.plan.system.webserver.response;
|
||||
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
@ -8,8 +10,8 @@ import java.io.IOException;
|
||||
*/
|
||||
public class CSSResponse extends FileResponse {
|
||||
|
||||
public CSSResponse(String fileName) throws IOException {
|
||||
super(format(fileName));
|
||||
public CSSResponse(String fileName, PlanFiles files) throws IOException {
|
||||
super(format(fileName), files);
|
||||
super.setType(ResponseType.CSS);
|
||||
setContent(getContent());
|
||||
}
|
||||
|
@ -19,12 +19,9 @@ import java.io.IOException;
|
||||
*/
|
||||
public class FileResponse extends Response {
|
||||
|
||||
// TODO
|
||||
private PlanFiles planFiles;
|
||||
|
||||
public FileResponse(String fileName) throws IOException {
|
||||
public FileResponse(String fileName, PlanFiles files) throws IOException {
|
||||
super.setHeader("HTTP/1.1 200 OK");
|
||||
super.setContent(planFiles.readCustomizableResourceFlat(fileName));
|
||||
super.setContent(files.readCustomizableResourceFlat(fileName));
|
||||
}
|
||||
|
||||
public static String format(String fileName) {
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.djrapitops.plan.system.webserver.response;
|
||||
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
@ -8,8 +10,8 @@ import java.io.IOException;
|
||||
*/
|
||||
public class JavaScriptResponse extends FileResponse {
|
||||
|
||||
JavaScriptResponse(String fileName) throws IOException {
|
||||
super(format(fileName));
|
||||
JavaScriptResponse(String fileName, PlanFiles files) throws IOException {
|
||||
super(format(fileName), files);
|
||||
super.setType(ResponseType.JAVASCRIPT);
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ public class ResponseFactory {
|
||||
|
||||
public Response javaScriptResponse(String fileName) {
|
||||
try {
|
||||
return new JavaScriptResponse(fileName);
|
||||
return new JavaScriptResponse(fileName, files);
|
||||
} catch (IOException e) {
|
||||
return notFound404("JS File not found from jar: " + fileName + ", " + e.toString());
|
||||
}
|
||||
@ -105,7 +105,7 @@ public class ResponseFactory {
|
||||
|
||||
public Response cssResponse(String fileName) {
|
||||
try {
|
||||
return new CSSResponse(fileName);
|
||||
return new CSSResponse(fileName, files);
|
||||
} catch (IOException e) {
|
||||
return notFound404("CSS File not found from jar: " + fileName + ", " + e.toString());
|
||||
}
|
||||
|
@ -24,9 +24,9 @@ public class ErrorResponse extends Response {
|
||||
|
||||
private String version;
|
||||
|
||||
public ErrorResponse(String version, PlanFiles planFiles) throws IOException {
|
||||
public ErrorResponse(String version, PlanFiles files) throws IOException {
|
||||
this.version = version;
|
||||
setContent(planFiles.readCustomizableResourceFlat("web/error.html"));
|
||||
setContent(files.readCustomizableResourceFlat("web/error.html"));
|
||||
}
|
||||
|
||||
public ErrorResponse(String message) {
|
||||
|
@ -42,7 +42,7 @@ public class HtmlExport extends SpecificExport {
|
||||
private final PlanPlugin plugin;
|
||||
private final Theme theme;
|
||||
private final Processing processing;
|
||||
private final PlanFiles planFiles;
|
||||
private final PlanFiles files;
|
||||
private final Database database;
|
||||
private final PageFactory pageFactory;
|
||||
private final ConnectionSystem connectionSystem;
|
||||
@ -51,7 +51,7 @@ public class HtmlExport extends SpecificExport {
|
||||
@Inject
|
||||
public HtmlExport(
|
||||
PlanPlugin plugin,
|
||||
PlanFiles planFiles,
|
||||
PlanFiles files,
|
||||
PlanConfig config,
|
||||
Theme theme,
|
||||
Processing processing,
|
||||
@ -61,11 +61,11 @@ public class HtmlExport extends SpecificExport {
|
||||
ConnectionSystem connectionSystem,
|
||||
ErrorHandler errorHandler
|
||||
) {
|
||||
super(planFiles, config, serverInfo);
|
||||
super(files, config, serverInfo);
|
||||
this.plugin = plugin;
|
||||
this.theme = theme;
|
||||
this.processing = processing;
|
||||
this.planFiles = planFiles;
|
||||
this.files = files;
|
||||
this.database = database;
|
||||
this.pageFactory = pageFactory;
|
||||
this.connectionSystem = connectionSystem;
|
||||
@ -186,7 +186,7 @@ public class HtmlExport extends SpecificExport {
|
||||
copyFromJar(resources);
|
||||
|
||||
try {
|
||||
String demo = planFiles.readFromResourceFlat("web/js/demo.js")
|
||||
String demo = files.readFromResourceFlat("web/js/demo.js")
|
||||
.replace("${defaultTheme}", theme.getValue(ThemeVal.THEME_DEFAULT));
|
||||
List<String> lines = Arrays.asList(demo.split("\n"));
|
||||
File outputFolder = new File(this.outputFolder, "js");
|
||||
|
@ -29,7 +29,7 @@ import java.util.UUID;
|
||||
*/
|
||||
public abstract class SpecificExport implements Runnable {
|
||||
|
||||
private final PlanFiles planFiles;
|
||||
private final PlanFiles files;
|
||||
private final PlanConfig config;
|
||||
private final ServerInfo serverInfo;
|
||||
|
||||
@ -37,11 +37,11 @@ public abstract class SpecificExport implements Runnable {
|
||||
private final boolean usingBungee;
|
||||
|
||||
protected SpecificExport(
|
||||
PlanFiles planFiles,
|
||||
PlanFiles files,
|
||||
PlanConfig config,
|
||||
ServerInfo serverInfo
|
||||
) {
|
||||
this.planFiles = planFiles;
|
||||
this.files = files;
|
||||
this.config = config;
|
||||
this.serverInfo = serverInfo;
|
||||
outputFolder = getFolder();
|
||||
@ -56,7 +56,7 @@ public abstract class SpecificExport implements Runnable {
|
||||
if (isAbsolute) {
|
||||
folder = new File(path);
|
||||
} else {
|
||||
File dataFolder = planFiles.getDataFolder();
|
||||
File dataFolder = files.getDataFolder();
|
||||
folder = new File(dataFolder, path);
|
||||
}
|
||||
|
||||
|
@ -28,16 +28,16 @@ public class AnalysisPage implements Page {
|
||||
|
||||
private final AnalysisContainer analysisContainer;
|
||||
|
||||
private final PlanFiles planFiles;
|
||||
private final PlanFiles files;
|
||||
private final Formatter<Double> decimalFormatter;
|
||||
|
||||
AnalysisPage(
|
||||
AnalysisContainer analysisContainer,
|
||||
PlanFiles planFiles,
|
||||
PlanFiles files,
|
||||
Formatter<Double> decimalFormatter
|
||||
) {
|
||||
this.analysisContainer = analysisContainer;
|
||||
this.planFiles = planFiles;
|
||||
this.files = files;
|
||||
this.decimalFormatter = decimalFormatter;
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ public class AnalysisPage implements Page {
|
||||
performanceNumbers(placeholderReplacer);
|
||||
|
||||
try {
|
||||
return placeholderReplacer.apply(planFiles.readCustomizableResourceFlat("web/server.html"));
|
||||
return placeholderReplacer.apply(files.readCustomizableResourceFlat("web/server.html"));
|
||||
} catch (IOException e) {
|
||||
throw new ParseException(e);
|
||||
} finally {
|
||||
|
@ -48,7 +48,7 @@ public class InspectPage implements Page {
|
||||
|
||||
private final String version;
|
||||
|
||||
private final PlanFiles planFiles;
|
||||
private final PlanFiles files;
|
||||
private final PlanConfig config;
|
||||
private final Theme theme;
|
||||
private final Graphs graphs;
|
||||
@ -65,7 +65,7 @@ public class InspectPage implements Page {
|
||||
InspectPage(
|
||||
PlayerContainer player, Map<UUID, String> serverNames,
|
||||
String version,
|
||||
PlanFiles planFiles,
|
||||
PlanFiles files,
|
||||
PlanConfig config,
|
||||
Theme theme,
|
||||
Graphs graphs,
|
||||
@ -78,7 +78,7 @@ public class InspectPage implements Page {
|
||||
this.player = player;
|
||||
this.serverNames = serverNames;
|
||||
this.version = version;
|
||||
this.planFiles = planFiles;
|
||||
this.files = files;
|
||||
this.config = config;
|
||||
this.theme = theme;
|
||||
this.graphs = graphs;
|
||||
@ -231,7 +231,7 @@ public class InspectPage implements Page {
|
||||
: serverName
|
||||
);
|
||||
|
||||
return replacer.apply(planFiles.readCustomizableResourceFlat("web/player.html"));
|
||||
return replacer.apply(files.readCustomizableResourceFlat("web/player.html"));
|
||||
}
|
||||
|
||||
private void sessionsAndPlaytime(PlaceholderReplacer replacer, SessionsMutator sessionsMutator, SessionsMutator daySessionsMutator, SessionsMutator weekSessionsMutator, SessionsMutator monthSessionsMutator) {
|
||||
|
@ -25,16 +25,16 @@ public class NetworkPage implements Page {
|
||||
|
||||
private final NetworkContainer networkContainer;
|
||||
|
||||
private final PlanFiles planFiles;
|
||||
private final PlanFiles files;
|
||||
private final ServerProperties serverProperties;
|
||||
|
||||
public NetworkPage(
|
||||
NetworkContainer networkContainer,
|
||||
PlanFiles planFiles,
|
||||
PlanFiles files,
|
||||
ServerProperties serverProperties
|
||||
) {
|
||||
this.networkContainer = networkContainer;
|
||||
this.planFiles = planFiles;
|
||||
this.files = files;
|
||||
this.serverProperties = serverProperties;
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ public class NetworkPage implements Page {
|
||||
ResponseCache.loadResponse(PageId.NETWORK_CONTENT.id(), NetworkPageContent::new);
|
||||
placeholderReplacer.put("tabContentServers", networkPageContent.getContents());
|
||||
|
||||
return placeholderReplacer.apply(planFiles.readCustomizableResourceFlat("web/network.html"));
|
||||
return placeholderReplacer.apply(files.readCustomizableResourceFlat("web/network.html"));
|
||||
} catch (Exception e) {
|
||||
throw new ParseException(e);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ import java.util.List;
|
||||
public class PlayersPage implements Page {
|
||||
|
||||
private final String version;
|
||||
private final PlanFiles planFiles;
|
||||
private final PlanFiles files;
|
||||
private final PlanConfig config;
|
||||
private final Database database;
|
||||
private final ServerInfo serverInfo;
|
||||
@ -33,7 +33,7 @@ public class PlayersPage implements Page {
|
||||
|
||||
PlayersPage(
|
||||
String version,
|
||||
PlanFiles planFiles,
|
||||
PlanFiles files,
|
||||
PlanConfig config,
|
||||
Database database,
|
||||
ServerInfo serverInfo,
|
||||
@ -41,7 +41,7 @@ public class PlayersPage implements Page {
|
||||
Timings timings
|
||||
) {
|
||||
this.version = version;
|
||||
this.planFiles = planFiles;
|
||||
this.files = files;
|
||||
this.config = config;
|
||||
this.database = database;
|
||||
this.serverInfo = serverInfo;
|
||||
@ -66,7 +66,7 @@ public class PlayersPage implements Page {
|
||||
placeholderReplacer.put("playersTable", tables.playerTableForPlayersPage(playerContainers).parseHtml());
|
||||
timings.end("Pages", "Players page players table parsing");
|
||||
|
||||
return placeholderReplacer.apply(planFiles.readCustomizableResourceFlat("web/players.html"));
|
||||
return placeholderReplacer.apply(files.readCustomizableResourceFlat("web/players.html"));
|
||||
} catch (Exception e) {
|
||||
throw new ParseException(e);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class GeolocationCacheTest {
|
||||
private final Map<String, String> ipsToCountries = new HashMap<>();
|
||||
|
||||
@Mock
|
||||
private PlanFiles planFiles;
|
||||
private PlanFiles files;
|
||||
@Mock
|
||||
private PlanConfig config;
|
||||
private GeolocationCache geolocationCache;
|
||||
@ -47,8 +47,8 @@ public class GeolocationCacheTest {
|
||||
|
||||
@Before
|
||||
public void setUp() throws IOException {
|
||||
doReturn(temporaryFolder.newFile("GeoIP.dat")).when(planFiles.getFileFromPluginFolder("GeoIP.dat"));
|
||||
geolocationCache = new GeolocationCache(new Locale(), planFiles, config, new TestPluginLogger());
|
||||
doReturn(temporaryFolder.newFile("GeoIP.dat")).when(files.getFileFromPluginFolder("GeoIP.dat"));
|
||||
geolocationCache = new GeolocationCache(new Locale(), files, config, new TestPluginLogger());
|
||||
|
||||
ipsToCountries.put("8.8.8.8", "United States");
|
||||
ipsToCountries.put("8.8.4.4", "United States");
|
||||
|
Loading…
Reference in New Issue
Block a user