mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-08-21 20:22:45 +02:00
[Smell] Renamed FileSystem to PlanFiles
This commit is contained in:
parent
594e9b4072
commit
b972c26fe8
|
@ -22,7 +22,7 @@ package com.djrapitops.plan;
|
|||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.command.PlanCommand;
|
||||
import com.djrapitops.plan.modules.APFModule;
|
||||
import com.djrapitops.plan.modules.FileSystemModule;
|
||||
import com.djrapitops.plan.modules.FilesModule;
|
||||
import com.djrapitops.plan.modules.SuperClassBindingModule;
|
||||
import com.djrapitops.plan.modules.SystemObjectBindingModule;
|
||||
import com.djrapitops.plan.modules.server.ServerSuperClassBindingModule;
|
||||
|
@ -55,7 +55,7 @@ import java.util.logging.Logger;
|
|||
SuperClassBindingModule.class,
|
||||
SystemObjectBindingModule.class,
|
||||
APFModule.class,
|
||||
FileSystemModule.class,
|
||||
FilesModule.class,
|
||||
BukkitInfoModule.class,
|
||||
ServerSuperClassBindingModule.class,
|
||||
BukkitSuperClassBindingModule.class
|
||||
|
|
|
@ -7,7 +7,7 @@ package com.djrapitops.plan;
|
|||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.command.PlanBungeeCommand;
|
||||
import com.djrapitops.plan.modules.APFModule;
|
||||
import com.djrapitops.plan.modules.FileSystemModule;
|
||||
import com.djrapitops.plan.modules.FilesModule;
|
||||
import com.djrapitops.plan.modules.SuperClassBindingModule;
|
||||
import com.djrapitops.plan.modules.SystemObjectBindingModule;
|
||||
import com.djrapitops.plan.modules.bungee.BungeeInfoModule;
|
||||
|
@ -37,7 +37,7 @@ import java.io.InputStream;
|
|||
SuperClassBindingModule.class,
|
||||
SystemObjectBindingModule.class,
|
||||
APFModule.class,
|
||||
FileSystemModule.class,
|
||||
FilesModule.class,
|
||||
BungeeSuperClassBindingModule.class,
|
||||
BungeeInfoModule.class
|
||||
})
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.djrapitops.plan;
|
|||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.command.PlanCommand;
|
||||
import com.djrapitops.plan.modules.APFModule;
|
||||
import com.djrapitops.plan.modules.FileSystemModule;
|
||||
import com.djrapitops.plan.modules.FilesModule;
|
||||
import com.djrapitops.plan.modules.SuperClassBindingModule;
|
||||
import com.djrapitops.plan.modules.SystemObjectBindingModule;
|
||||
import com.djrapitops.plan.modules.server.ServerSuperClassBindingModule;
|
||||
|
@ -43,7 +43,7 @@ import java.io.InputStream;
|
|||
SuperClassBindingModule.class,
|
||||
SystemObjectBindingModule.class,
|
||||
APFModule.class,
|
||||
FileSystemModule.class,
|
||||
FilesModule.class,
|
||||
ServerSuperClassBindingModule.class,
|
||||
SpongeSuperClassBindingModule.class,
|
||||
SpongeInfoModule.class
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.djrapitops.plan.command.commands.manage;
|
|||
import com.djrapitops.plan.system.database.DBSystem;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.system.database.databases.sql.SQLiteDB;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.locale.Locale;
|
||||
import com.djrapitops.plan.system.locale.lang.CmdHelpLang;
|
||||
import com.djrapitops.plan.system.locale.lang.CommandLang;
|
||||
|
@ -35,7 +35,7 @@ public class ManageRestoreCommand extends CommandNode {
|
|||
private final DBSystem dbSystem;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final SQLiteDB.Factory sqliteFactory;
|
||||
private final FileSystem fileSystem;
|
||||
private final PlanFiles planFiles;
|
||||
|
||||
@Inject
|
||||
public ManageRestoreCommand(
|
||||
|
@ -43,7 +43,7 @@ public class ManageRestoreCommand extends CommandNode {
|
|||
Processing processing,
|
||||
DBSystem dbSystem,
|
||||
SQLiteDB.Factory sqliteFactory,
|
||||
FileSystem fileSystem,
|
||||
PlanFiles planFiles,
|
||||
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.fileSystem = fileSystem;
|
||||
this.planFiles = planFiles;
|
||||
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 = fileSystem.getFileFromPluginFolder(backupDBName + (containsDBFileExtension ? "" : ".db"));
|
||||
File backupDBFile = planFiles.getFileFromPluginFolder(backupDBName + (containsDBFileExtension ? "" : ".db"));
|
||||
|
||||
if (!backupDBFile.exists()) {
|
||||
sender.sendMessage(locale.getString(ManageLang.FAIL_FILE_NOT_FOUND, backupDBFile.getAbsolutePath()));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.djrapitops.plan.modules;
|
||||
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
|
@ -9,18 +9,18 @@ import javax.inject.Singleton;
|
|||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Dagger Module for the Plan FileSystem.
|
||||
* Dagger Module for the Plan files.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@Module
|
||||
public class FileSystemModule {
|
||||
public class FilesModule {
|
||||
|
||||
@Provides
|
||||
@Named("configFile")
|
||||
@Singleton
|
||||
File provideConfigFile(FileSystem fileSystem) {
|
||||
return fileSystem.getConfigFile();
|
||||
File provideConfigFile(PlanFiles planFiles) {
|
||||
return planFiles.getConfigFile();
|
||||
}
|
||||
|
||||
}
|
|
@ -11,7 +11,7 @@ import com.djrapitops.plan.data.plugin.HookHandler;
|
|||
import com.djrapitops.plan.system.cache.CacheSystem;
|
||||
import com.djrapitops.plan.system.database.DBSystem;
|
||||
import com.djrapitops.plan.system.export.ExportSystem;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.importing.ImportSystem;
|
||||
import com.djrapitops.plan.system.info.InfoSystem;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
|
@ -38,7 +38,7 @@ import javax.inject.Singleton;
|
|||
@Singleton
|
||||
public class PlanSystem implements SubSystem {
|
||||
|
||||
private final FileSystem fileSystem;
|
||||
private final PlanFiles planFiles;
|
||||
private final ConfigSystem configSystem;
|
||||
private final VersionCheckSystem versionCheckSystem;
|
||||
private final LocaleSystem localeSystem;
|
||||
|
@ -60,7 +60,7 @@ public class PlanSystem implements SubSystem {
|
|||
|
||||
@Inject
|
||||
public PlanSystem(
|
||||
FileSystem fileSystem,
|
||||
PlanFiles planFiles,
|
||||
ConfigSystem configSystem,
|
||||
VersionCheckSystem versionCheckSystem,
|
||||
LocaleSystem localeSystem,
|
||||
|
@ -78,7 +78,7 @@ public class PlanSystem implements SubSystem {
|
|||
PlanAPI planAPI,
|
||||
ErrorHandler errorHandler
|
||||
) {
|
||||
this.fileSystem = fileSystem;
|
||||
this.planFiles = planFiles;
|
||||
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(
|
||||
fileSystem,
|
||||
planFiles,
|
||||
configSystem,
|
||||
localeSystem,
|
||||
versionCheckSystem,
|
||||
|
@ -143,7 +143,7 @@ public class PlanSystem implements SubSystem {
|
|||
serverInfo,
|
||||
localeSystem,
|
||||
configSystem,
|
||||
fileSystem,
|
||||
planFiles,
|
||||
versionCheckSystem
|
||||
);
|
||||
}
|
||||
|
@ -170,8 +170,8 @@ public class PlanSystem implements SubSystem {
|
|||
return configSystem;
|
||||
}
|
||||
|
||||
public FileSystem getFileSystem() {
|
||||
return fileSystem;
|
||||
public PlanFiles getPlanFiles() {
|
||||
return planFiles;
|
||||
}
|
||||
|
||||
public DBSystem getDatabaseSystem() {
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.djrapitops.plan.system.cache;
|
|||
|
||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.system.SubSystem;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.locale.Locale;
|
||||
import com.djrapitops.plan.system.locale.lang.PluginLang;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
|
@ -40,7 +40,7 @@ import java.util.zip.GZIPInputStream;
|
|||
public class GeolocationCache implements SubSystem {
|
||||
|
||||
private final Locale locale;
|
||||
private final FileSystem fileSystem;
|
||||
private final PlanFiles planFiles;
|
||||
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,
|
||||
FileSystem fileSystem,
|
||||
PlanFiles planFiles,
|
||||
PlanConfig config,
|
||||
PluginLogger logger
|
||||
) {
|
||||
this.locale = locale;
|
||||
this.fileSystem = fileSystem;
|
||||
this.planFiles = planFiles;
|
||||
this.config = config;
|
||||
this.logger = logger;
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class GeolocationCache implements SubSystem {
|
|||
|
||||
@Override
|
||||
public void enable() throws EnableException {
|
||||
geolocationDB = fileSystem.getFileFromPluginFolder("GeoIP.dat");
|
||||
geolocationDB = planFiles.getFileFromPluginFolder("GeoIP.dat");
|
||||
if (config.isTrue(Settings.DATA_GEOLOCATIONS)) {
|
||||
try {
|
||||
checkDB();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.djrapitops.plan.system.database.databases.sql;
|
||||
|
||||
import com.djrapitops.plan.api.exceptions.database.DBInitException;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.locale.Locale;
|
||||
import com.djrapitops.plan.system.locale.lang.PluginLang;
|
||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||
|
@ -183,13 +183,13 @@ public class SQLiteDB extends SQLDB {
|
|||
private final PluginLogger logger;
|
||||
private final Timings timings;
|
||||
private final ErrorHandler errorHandler;
|
||||
private FileSystem fileSystem;
|
||||
private PlanFiles planFiles;
|
||||
|
||||
@Inject
|
||||
public Factory(
|
||||
Locale locale,
|
||||
PlanConfig config,
|
||||
FileSystem fileSystem,
|
||||
PlanFiles planFiles,
|
||||
RunnableFactory runnableFactory,
|
||||
PluginLogger logger,
|
||||
Timings timings,
|
||||
|
@ -197,7 +197,7 @@ public class SQLiteDB extends SQLDB {
|
|||
) {
|
||||
this.locale = locale;
|
||||
this.config = config;
|
||||
this.fileSystem = fileSystem;
|
||||
this.planFiles = planFiles;
|
||||
this.runnableFactory = runnableFactory;
|
||||
this.logger = logger;
|
||||
this.timings = timings;
|
||||
|
@ -209,7 +209,7 @@ public class SQLiteDB extends SQLDB {
|
|||
}
|
||||
|
||||
public SQLiteDB usingFileCalled(String fileName) {
|
||||
return usingFile(fileSystem.getFileFromPluginFolder(fileName + ".db"));
|
||||
return usingFile(planFiles.getFileFromPluginFolder(fileName + ".db"));
|
||||
}
|
||||
|
||||
public SQLiteDB usingFile(File databaseFile) {
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit;
|
|||
* @author Rsl1122
|
||||
*/
|
||||
@Singleton
|
||||
public class FileSystem implements SubSystem {
|
||||
public class PlanFiles implements SubSystem {
|
||||
|
||||
private final PlanPlugin plugin;
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class FileSystem implements SubSystem {
|
|||
private final File configFile;
|
||||
|
||||
@Inject
|
||||
public FileSystem(PlanPlugin plugin) {
|
||||
public PlanFiles(PlanPlugin plugin) {
|
||||
this.dataFolder = plugin.getDataFolder();
|
||||
this.plugin = plugin;
|
||||
this.configFile = getFileFromPluginFolder("config.yml");
|
||||
|
@ -70,7 +70,7 @@ public class FileSystem implements SubSystem {
|
|||
() -> new EnableException("Could not create config file at " + configFile.getAbsolutePath()));
|
||||
|
||||
// TODO Log Keep Day threshold from Settings
|
||||
// TODO Move This task creation outside of FileSystem class
|
||||
// TODO Move This task creation outside of PlanFiles class
|
||||
plugin.getRunnableFactory().create("Logs folder Clean Task",
|
||||
new LogsFolderCleanTask(getLogsFolder(), 5, plugin.getPluginLogger())
|
||||
).runTaskLaterAsynchronously(TimeAmount.toTicks(30L, TimeUnit.SECONDS));
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
package com.djrapitops.plan.system.info.server;
|
||||
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plugin.config.Config;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
||||
|
@ -23,16 +23,16 @@ import java.util.UUID;
|
|||
*/
|
||||
public class ServerInfoFile extends Config {
|
||||
|
||||
private final FileSystem fileSystem;
|
||||
private final PlanFiles planFiles;
|
||||
|
||||
@Inject
|
||||
public ServerInfoFile(FileSystem fileSystem) {
|
||||
super(fileSystem.getFileFromPluginFolder("ServerInfoFile.yml"));
|
||||
this.fileSystem = fileSystem;
|
||||
public ServerInfoFile(PlanFiles planFiles) {
|
||||
super(planFiles.getFileFromPluginFolder("ServerInfoFile.yml"));
|
||||
this.planFiles = planFiles;
|
||||
}
|
||||
|
||||
public void prepare() throws IOException {
|
||||
copyDefaults(fileSystem.readFromResource("DefaultServerInfoFile.yml"));
|
||||
copyDefaults(planFiles.readFromResource("DefaultServerInfoFile.yml"));
|
||||
save();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.djrapitops.plan.system.locale;
|
||||
|
||||
import com.djrapitops.plan.system.SubSystem;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.locale.lang.*;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||
|
@ -28,7 +28,7 @@ import java.util.stream.Collectors;
|
|||
@Singleton
|
||||
public class LocaleSystem implements SubSystem {
|
||||
|
||||
private final FileSystem fileSystem;
|
||||
private final PlanFiles planFiles;
|
||||
private final PlanConfig config;
|
||||
private final PluginLogger logger;
|
||||
private final ErrorHandler errorHandler;
|
||||
|
@ -37,12 +37,12 @@ public class LocaleSystem implements SubSystem {
|
|||
|
||||
@Inject
|
||||
public LocaleSystem(
|
||||
FileSystem fileSystem,
|
||||
PlanFiles planFiles,
|
||||
PlanConfig config,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
) {
|
||||
this.fileSystem = fileSystem;
|
||||
this.planFiles = planFiles;
|
||||
this.config = config;
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
|
@ -72,7 +72,7 @@ public class LocaleSystem implements SubSystem {
|
|||
|
||||
@Override
|
||||
public void enable() {
|
||||
File localeFile = fileSystem.getLocaleFile();
|
||||
File localeFile = planFiles.getLocaleFile();
|
||||
|
||||
if (config.isTrue(Settings.WRITE_NEW_LOCALE)) {
|
||||
writeNewDefaultLocale(localeFile);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
package com.djrapitops.plan.system.settings.config;
|
||||
|
||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.settings.theme.Theme;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
|
||||
|
@ -25,17 +25,17 @@ public class BukkitConfigSystem extends ConfigSystem {
|
|||
|
||||
@Inject
|
||||
public BukkitConfigSystem(
|
||||
FileSystem fileSystem,
|
||||
PlanFiles planFiles,
|
||||
PlanConfig config,
|
||||
Theme theme,
|
||||
ErrorHandler errorHandler
|
||||
) {
|
||||
super(fileSystem, config, theme, errorHandler);
|
||||
super(planFiles, config, theme, errorHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void copyDefaults() throws IOException {
|
||||
config.copyDefaults(fileSystem.readFromResource("config.yml"));
|
||||
config.copyDefaults(planFiles.readFromResource("config.yml"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
package com.djrapitops.plan.system.settings.config;
|
||||
|
||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.settings.theme.Theme;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
|
||||
|
@ -25,17 +25,17 @@ public class BungeeConfigSystem extends ConfigSystem {
|
|||
|
||||
@Inject
|
||||
public BungeeConfigSystem(
|
||||
FileSystem fileSystem,
|
||||
PlanFiles planFiles,
|
||||
PlanConfig config,
|
||||
Theme theme,
|
||||
ErrorHandler errorHandler
|
||||
) {
|
||||
super(fileSystem, config, theme, errorHandler);
|
||||
super(planFiles, config, theme, errorHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void copyDefaults() throws IOException {
|
||||
config.copyDefaults(fileSystem.readFromResource("bungeeconfig.yml"));
|
||||
config.copyDefaults(planFiles.readFromResource("bungeeconfig.yml"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,7 +6,7 @@ package com.djrapitops.plan.system.settings.config;
|
|||
|
||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.system.SubSystem;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plan.system.settings.theme.Theme;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
|
@ -24,18 +24,18 @@ import java.io.IOException;
|
|||
@Singleton
|
||||
public abstract class ConfigSystem implements SubSystem {
|
||||
|
||||
protected final FileSystem fileSystem;
|
||||
protected final PlanFiles planFiles;
|
||||
protected final PlanConfig config;
|
||||
protected final Theme theme;
|
||||
protected final ErrorHandler errorHandler;
|
||||
|
||||
public ConfigSystem(
|
||||
FileSystem fileSystem,
|
||||
PlanFiles planFiles,
|
||||
PlanConfig config,
|
||||
Theme theme,
|
||||
ErrorHandler errorHandler
|
||||
) {
|
||||
this.fileSystem = fileSystem;
|
||||
this.planFiles = planFiles;
|
||||
this.config = config;
|
||||
this.theme = theme;
|
||||
this.errorHandler = errorHandler;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.djrapitops.plan.system.settings.config;
|
||||
|
||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plan.system.settings.theme.Theme;
|
||||
import com.djrapitops.plugin.logging.console.PluginLogger;
|
||||
|
@ -25,19 +25,19 @@ public class SpongeConfigSystem extends BukkitConfigSystem {
|
|||
|
||||
@Inject
|
||||
public SpongeConfigSystem(
|
||||
FileSystem fileSystem,
|
||||
PlanFiles planFiles,
|
||||
PlanConfig config,
|
||||
Theme theme,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
) {
|
||||
super(fileSystem, config, theme, errorHandler);
|
||||
super(planFiles, config, theme, errorHandler);
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable() throws EnableException {
|
||||
firstInstall = !fileSystem.getConfigFile().exists();
|
||||
firstInstall = !planFiles.getConfigFile().exists();
|
||||
super.enable();
|
||||
config.getNetworkSettings().loadSettingsFromDB();
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
package com.djrapitops.plan.system.settings.theme;
|
||||
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||
import com.djrapitops.plugin.config.Config;
|
||||
|
@ -27,8 +27,8 @@ import java.util.List;
|
|||
public class ThemeConfig extends Config {
|
||||
|
||||
@Inject
|
||||
public ThemeConfig(FileSystem fileSystem, PlanConfig config, PluginLogger logger) {
|
||||
this(getConfigFile(fileSystem), getDefaults(fileSystem, config, logger));
|
||||
public ThemeConfig(PlanFiles planFiles, PlanConfig config, PluginLogger logger) {
|
||||
this(getConfigFile(planFiles), getDefaults(planFiles, config, logger));
|
||||
}
|
||||
|
||||
private ThemeConfig(File configFile, List<String> defaults) {
|
||||
|
@ -43,12 +43,12 @@ public class ThemeConfig extends Config {
|
|||
}
|
||||
}
|
||||
|
||||
private static List<String> getDefaults(FileSystem fileSystem, PlanConfig config, PluginLogger logger) {
|
||||
private static List<String> getDefaults(PlanFiles planFiles, PlanConfig config, PluginLogger logger) {
|
||||
String fileName = config.getString(Settings.THEME_BASE);
|
||||
String fileLocation = getFileLocation(fileName);
|
||||
|
||||
try {
|
||||
return fileSystem.readFromResource(fileLocation);
|
||||
return planFiles.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(FileSystem fileSystem) {
|
||||
return fileSystem.getFileFromPluginFolder("theme.yml");
|
||||
private static File getConfigFile(PlanFiles planFiles) {
|
||||
return planFiles.getFileFromPluginFolder("theme.yml");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.djrapitops.plan.system.webserver;
|
|||
|
||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.system.SubSystem;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.info.server.properties.ServerProperties;
|
||||
import com.djrapitops.plan.system.locale.Locale;
|
||||
import com.djrapitops.plan.system.locale.lang.PluginLang;
|
||||
|
@ -40,7 +40,7 @@ import java.util.concurrent.TimeUnit;
|
|||
public class WebServer implements SubSystem {
|
||||
|
||||
private final Locale locale;
|
||||
private final FileSystem fileSystem;
|
||||
private final PlanFiles planFiles;
|
||||
private final PlanConfig config;
|
||||
|
||||
private final ServerProperties serverProperties;
|
||||
|
@ -58,7 +58,7 @@ public class WebServer implements SubSystem {
|
|||
@Inject
|
||||
public WebServer(
|
||||
Locale locale,
|
||||
FileSystem fileSystem,
|
||||
PlanFiles planFiles,
|
||||
PlanConfig config,
|
||||
ServerProperties serverProperties,
|
||||
PluginLogger logger,
|
||||
|
@ -66,7 +66,7 @@ public class WebServer implements SubSystem {
|
|||
RequestHandler requestHandler
|
||||
) {
|
||||
this.locale = locale;
|
||||
this.fileSystem = fileSystem;
|
||||
this.planFiles = planFiles;
|
||||
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 = fileSystem.getDataFolder() + File.separator + keyStorePath;
|
||||
keyStorePath = planFiles.getDataFolder() + File.separator + keyStorePath;
|
||||
}
|
||||
|
||||
char[] storepass = config.getString(Settings.WEBSERVER_CERTIFICATE_STOREPASS).toCharArray();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
package com.djrapitops.plan.system.webserver.response;
|
||||
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.webserver.response.errors.NotFoundResponse;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
||||
|
@ -21,12 +21,12 @@ import java.io.IOException;
|
|||
public class FileResponse extends Response {
|
||||
|
||||
// TODO
|
||||
private FileSystem fileSystem;
|
||||
private PlanFiles planFiles;
|
||||
|
||||
public FileResponse(String fileName) {
|
||||
super.setHeader("HTTP/1.1 200 OK");
|
||||
try {
|
||||
super.setContent(fileSystem.readCustomizableResourceFlat(fileName));
|
||||
super.setContent(planFiles.readCustomizableResourceFlat(fileName));
|
||||
} catch (IOException e) {
|
||||
super.setContent(new NotFoundResponse(fileName + " was not found inside the .jar or /plugins/Plan/ folder").getContent());
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
package com.djrapitops.plan.system.webserver.response.errors;
|
||||
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.webserver.response.Response;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
|
@ -26,12 +26,12 @@ public class ErrorResponse extends Response {
|
|||
|
||||
// TODO
|
||||
private String version;
|
||||
private FileSystem fileSystem;
|
||||
private PlanFiles planFiles;
|
||||
private ErrorHandler errorHandler;
|
||||
|
||||
public ErrorResponse() {
|
||||
try {
|
||||
setContent(fileSystem.readCustomizableResourceFlat("web/error.html"));
|
||||
setContent(planFiles.readCustomizableResourceFlat("web/error.html"));
|
||||
} catch (IOException e) {
|
||||
errorHandler.log(L.WARN, this.getClass(), e);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.djrapitops.plan.api.exceptions.ParseException;
|
|||
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
||||
import com.djrapitops.plan.data.container.UserInfo;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.system.processing.Processing;
|
||||
|
@ -42,7 +42,7 @@ public class HtmlExport extends SpecificExport {
|
|||
private final PlanPlugin plugin;
|
||||
private final Theme theme;
|
||||
private final Processing processing;
|
||||
private final FileSystem fileSystem;
|
||||
private final PlanFiles planFiles;
|
||||
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,
|
||||
FileSystem fileSystem,
|
||||
PlanFiles planFiles,
|
||||
PlanConfig config,
|
||||
Theme theme,
|
||||
Processing processing,
|
||||
|
@ -61,11 +61,11 @@ public class HtmlExport extends SpecificExport {
|
|||
ConnectionSystem connectionSystem,
|
||||
ErrorHandler errorHandler
|
||||
) {
|
||||
super(fileSystem, config, serverInfo);
|
||||
super(planFiles, config, serverInfo);
|
||||
this.plugin = plugin;
|
||||
this.theme = theme;
|
||||
this.processing = processing;
|
||||
this.fileSystem = fileSystem;
|
||||
this.planFiles = planFiles;
|
||||
this.database = database;
|
||||
this.pageFactory = pageFactory;
|
||||
this.connectionSystem = connectionSystem;
|
||||
|
@ -186,7 +186,7 @@ public class HtmlExport extends SpecificExport {
|
|||
copyFromJar(resources);
|
||||
|
||||
try {
|
||||
String demo = fileSystem.readFromResourceFlat("web/js/demo.js")
|
||||
String demo = planFiles.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");
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
package com.djrapitops.plan.utilities.file.export;
|
||||
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||
|
@ -29,7 +29,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public abstract class SpecificExport implements Runnable {
|
||||
|
||||
private final FileSystem fileSystem;
|
||||
private final PlanFiles planFiles;
|
||||
private final PlanConfig config;
|
||||
private final ServerInfo serverInfo;
|
||||
|
||||
|
@ -37,11 +37,11 @@ public abstract class SpecificExport implements Runnable {
|
|||
private final boolean usingBungee;
|
||||
|
||||
protected SpecificExport(
|
||||
FileSystem fileSystem,
|
||||
PlanFiles planFiles,
|
||||
PlanConfig config,
|
||||
ServerInfo serverInfo
|
||||
) {
|
||||
this.fileSystem = fileSystem;
|
||||
this.planFiles = planFiles;
|
||||
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 = fileSystem.getDataFolder();
|
||||
File dataFolder = planFiles.getDataFolder();
|
||||
folder = new File(dataFolder, path);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ package com.djrapitops.plan.utilities.html.pages;
|
|||
|
||||
import com.djrapitops.plan.api.exceptions.ParseException;
|
||||
import com.djrapitops.plan.data.store.containers.AnalysisContainer;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.webserver.response.errors.ErrorResponse;
|
||||
import com.djrapitops.plan.utilities.formatting.Formatter;
|
||||
import com.djrapitops.plan.utilities.formatting.PlaceholderReplacer;
|
||||
|
@ -28,16 +28,16 @@ public class AnalysisPage implements Page {
|
|||
|
||||
private final AnalysisContainer analysisContainer;
|
||||
|
||||
private final FileSystem fileSystem;
|
||||
private final PlanFiles planFiles;
|
||||
private final Formatter<Double> decimalFormatter;
|
||||
|
||||
AnalysisPage(
|
||||
AnalysisContainer analysisContainer,
|
||||
FileSystem fileSystem,
|
||||
PlanFiles planFiles,
|
||||
Formatter<Double> decimalFormatter
|
||||
) {
|
||||
this.analysisContainer = analysisContainer;
|
||||
this.fileSystem = fileSystem;
|
||||
this.planFiles = planFiles;
|
||||
this.decimalFormatter = decimalFormatter;
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ public class AnalysisPage implements Page {
|
|||
performanceNumbers(placeholderReplacer);
|
||||
|
||||
try {
|
||||
return placeholderReplacer.apply(fileSystem.readCustomizableResourceFlat("web/server.html"));
|
||||
return placeholderReplacer.apply(planFiles.readCustomizableResourceFlat("web/server.html"));
|
||||
} catch (IOException e) {
|
||||
throw new ParseException(e);
|
||||
} finally {
|
||||
|
|
|
@ -12,7 +12,7 @@ import com.djrapitops.plan.data.store.keys.PlayerKeys;
|
|||
import com.djrapitops.plan.data.store.mutators.*;
|
||||
import com.djrapitops.plan.data.time.WorldTimes;
|
||||
import com.djrapitops.plan.system.cache.SessionCache;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||
|
@ -48,7 +48,7 @@ public class InspectPage implements Page {
|
|||
|
||||
private final String version;
|
||||
|
||||
private final FileSystem fileSystem;
|
||||
private final PlanFiles planFiles;
|
||||
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,
|
||||
FileSystem fileSystem,
|
||||
PlanFiles planFiles,
|
||||
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.fileSystem = fileSystem;
|
||||
this.planFiles = planFiles;
|
||||
this.config = config;
|
||||
this.theme = theme;
|
||||
this.graphs = graphs;
|
||||
|
@ -231,7 +231,7 @@ public class InspectPage implements Page {
|
|||
: serverName
|
||||
);
|
||||
|
||||
return replacer.apply(fileSystem.readCustomizableResourceFlat("web/player.html"));
|
||||
return replacer.apply(planFiles.readCustomizableResourceFlat("web/player.html"));
|
||||
}
|
||||
|
||||
private void sessionsAndPlaytime(PlaceholderReplacer replacer, SessionsMutator sessionsMutator, SessionsMutator daySessionsMutator, SessionsMutator weekSessionsMutator, SessionsMutator monthSessionsMutator) {
|
||||
|
|
|
@ -7,7 +7,7 @@ package com.djrapitops.plan.utilities.html.pages;
|
|||
import com.djrapitops.plan.api.exceptions.ParseException;
|
||||
import com.djrapitops.plan.data.store.containers.NetworkContainer;
|
||||
import com.djrapitops.plan.data.store.keys.NetworkKeys;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.info.server.properties.ServerProperties;
|
||||
import com.djrapitops.plan.system.webserver.cache.PageId;
|
||||
import com.djrapitops.plan.system.webserver.cache.ResponseCache;
|
||||
|
@ -25,16 +25,16 @@ public class NetworkPage implements Page {
|
|||
|
||||
private final NetworkContainer networkContainer;
|
||||
|
||||
private final FileSystem fileSystem;
|
||||
private final PlanFiles planFiles;
|
||||
private final ServerProperties serverProperties;
|
||||
|
||||
public NetworkPage(
|
||||
NetworkContainer networkContainer,
|
||||
FileSystem fileSystem,
|
||||
PlanFiles planFiles,
|
||||
ServerProperties serverProperties
|
||||
) {
|
||||
this.networkContainer = networkContainer;
|
||||
this.fileSystem = fileSystem;
|
||||
this.planFiles = planFiles;
|
||||
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(fileSystem.readCustomizableResourceFlat("web/network.html"));
|
||||
return placeholderReplacer.apply(planFiles.readCustomizableResourceFlat("web/network.html"));
|
||||
} catch (Exception e) {
|
||||
throw new ParseException(e);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.djrapitops.plan.data.store.containers.AnalysisContainer;
|
|||
import com.djrapitops.plan.data.store.containers.NetworkContainer;
|
||||
import com.djrapitops.plan.data.store.containers.PlayerContainer;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||
|
@ -35,7 +35,7 @@ import java.util.UUID;
|
|||
public class PageFactory {
|
||||
|
||||
private final String version;
|
||||
private final Lazy<FileSystem> fileSystem;
|
||||
private final Lazy<PlanFiles> fileSystem;
|
||||
private final Lazy<PlanConfig> config;
|
||||
private final Lazy<Theme> theme;
|
||||
private final Lazy<Database> database;
|
||||
|
@ -53,7 +53,7 @@ public class PageFactory {
|
|||
@Inject
|
||||
public PageFactory(
|
||||
@Named("currentVersion") String version,
|
||||
Lazy<FileSystem> fileSystem,
|
||||
Lazy<PlanFiles> fileSystem,
|
||||
Lazy<PlanConfig> config,
|
||||
Lazy<Theme> theme,
|
||||
Lazy<Database> database,
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.djrapitops.plan.utilities.html.pages;
|
|||
import com.djrapitops.plan.api.exceptions.ParseException;
|
||||
import com.djrapitops.plan.data.store.containers.PlayerContainer;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||
|
@ -22,7 +22,7 @@ import java.util.List;
|
|||
public class PlayersPage implements Page {
|
||||
|
||||
private final String version;
|
||||
private final FileSystem fileSystem;
|
||||
private final PlanFiles planFiles;
|
||||
private final PlanConfig config;
|
||||
private final Database database;
|
||||
private final ServerInfo serverInfo;
|
||||
|
@ -33,7 +33,7 @@ public class PlayersPage implements Page {
|
|||
|
||||
PlayersPage(
|
||||
String version,
|
||||
FileSystem fileSystem,
|
||||
PlanFiles planFiles,
|
||||
PlanConfig config,
|
||||
Database database,
|
||||
ServerInfo serverInfo,
|
||||
|
@ -41,7 +41,7 @@ public class PlayersPage implements Page {
|
|||
Timings timings
|
||||
) {
|
||||
this.version = version;
|
||||
this.fileSystem = fileSystem;
|
||||
this.planFiles = planFiles;
|
||||
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(fileSystem.readCustomizableResourceFlat("web/players.html"));
|
||||
return placeholderReplacer.apply(planFiles.readCustomizableResourceFlat("web/players.html"));
|
||||
} catch (Exception e) {
|
||||
throw new ParseException(e);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.djrapitops.plan.system.cache;
|
||||
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.locale.Locale;
|
||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||
import com.djrapitops.plugin.logging.console.TestPluginLogger;
|
||||
|
@ -30,7 +30,7 @@ public class GeolocationCacheTest {
|
|||
private final Map<String, String> ipsToCountries = new HashMap<>();
|
||||
|
||||
@Mock
|
||||
private FileSystem fileSystem;
|
||||
private PlanFiles planFiles;
|
||||
@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(fileSystem.getFileFromPluginFolder("GeoIP.dat"));
|
||||
geolocationCache = new GeolocationCache(new Locale(), fileSystem, config, new TestPluginLogger());
|
||||
doReturn(temporaryFolder.newFile("GeoIP.dat")).when(planFiles.getFileFromPluginFolder("GeoIP.dat"));
|
||||
geolocationCache = new GeolocationCache(new Locale(), planFiles, config, new TestPluginLogger());
|
||||
|
||||
ipsToCountries.put("8.8.8.8", "United States");
|
||||
ipsToCountries.put("8.8.4.4", "United States");
|
||||
|
|
|
@ -30,7 +30,7 @@ public class SystemMockUtil {
|
|||
}
|
||||
|
||||
public SystemMockUtil enableConfigSystem() throws Exception {
|
||||
bukkitSystem.getFileSystem().enable();
|
||||
bukkitSystem.getPlanFiles().enable();
|
||||
bukkitSystem.getConfigSystem().enable();
|
||||
return this;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user