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