mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-01 05:57:50 +01:00
[Test] Fixed BukkitSystemTest
This test was tougher than usual to fix, since Database could not be provided during object construction due to config setting default not being loaded. This would have lead to new installs not functioning. Fixed by replacing all Database injections with DBSystem
This commit is contained in:
parent
2e4464b558
commit
55c49bd220
@ -95,7 +95,7 @@ public class PlanBungee extends BungeePlugin implements PlanPlugin {
|
|||||||
|
|
||||||
new BStatsBungee(
|
new BStatsBungee(
|
||||||
this,
|
this,
|
||||||
system.getDatabaseSystem().getActiveDatabase(),
|
system.getDatabaseSystem().getDatabase(),
|
||||||
system.getInfoSystem().getConnectionSystem()
|
system.getInfoSystem().getConnectionSystem()
|
||||||
).registerMetrics();
|
).registerMetrics();
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ public class PlanSponge extends SpongePlugin implements PlanPlugin {
|
|||||||
|
|
||||||
new BStatsSponge(
|
new BStatsSponge(
|
||||||
metrics,
|
metrics,
|
||||||
system.getDatabaseSystem().getActiveDatabase()
|
system.getDatabaseSystem().getDatabase()
|
||||||
).registerMetrics();
|
).registerMetrics();
|
||||||
|
|
||||||
slf4jLogger.info(locale.getString(PluginLang.ENABLED));
|
slf4jLogger.info(locale.getString(PluginLang.ENABLED));
|
||||||
|
@ -10,6 +10,7 @@ import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
|||||||
import com.djrapitops.plan.data.container.Session;
|
import com.djrapitops.plan.data.container.Session;
|
||||||
import com.djrapitops.plan.data.store.keys.SessionKeys;
|
import com.djrapitops.plan.data.store.keys.SessionKeys;
|
||||||
import com.djrapitops.plan.system.cache.SessionCache;
|
import com.djrapitops.plan.system.cache.SessionCache;
|
||||||
|
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.plugin.logging.L;
|
import com.djrapitops.plugin.logging.L;
|
||||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||||
@ -29,12 +30,12 @@ import java.util.UUID;
|
|||||||
public class ShutdownHook extends Thread {
|
public class ShutdownHook extends Thread {
|
||||||
|
|
||||||
private static ShutdownHook activated;
|
private static ShutdownHook activated;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final ErrorHandler errorHandler;
|
private final ErrorHandler errorHandler;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ShutdownHook(Database database, ErrorHandler errorHandler) {
|
public ShutdownHook(DBSystem dbSystem, ErrorHandler errorHandler) {
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +72,7 @@ public class ShutdownHook extends Thread {
|
|||||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
database.close();
|
dbSystem.getDatabase().close();
|
||||||
} catch (DBException e) {
|
} catch (DBException e) {
|
||||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||||
}
|
}
|
||||||
@ -86,6 +87,7 @@ public class ShutdownHook extends Thread {
|
|||||||
if (!end.isPresent()) {
|
if (!end.isPresent()) {
|
||||||
session.endSession(now);
|
session.endSession(now);
|
||||||
}
|
}
|
||||||
|
Database database = dbSystem.getDatabase();
|
||||||
if (!database.isOpen()) {
|
if (!database.isOpen()) {
|
||||||
database.init();
|
database.init();
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ package com.djrapitops.plan.api;
|
|||||||
|
|
||||||
import com.djrapitops.plan.data.plugin.HookHandler;
|
import com.djrapitops.plan.data.plugin.HookHandler;
|
||||||
import com.djrapitops.plan.data.plugin.PluginData;
|
import com.djrapitops.plan.data.plugin.PluginData;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
import com.djrapitops.plan.system.database.databases.operation.FetchOperations;
|
import com.djrapitops.plan.system.database.databases.operation.FetchOperations;
|
||||||
import com.djrapitops.plan.utilities.uuid.UUIDUtility;
|
import com.djrapitops.plan.utilities.uuid.UUIDUtility;
|
||||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||||
@ -24,18 +24,18 @@ import java.util.UUID;
|
|||||||
public class ProxyAPI extends CommonAPI {
|
public class ProxyAPI extends CommonAPI {
|
||||||
|
|
||||||
private final HookHandler hookHandler;
|
private final HookHandler hookHandler;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ProxyAPI(
|
public ProxyAPI(
|
||||||
UUIDUtility uuidUtility,
|
UUIDUtility uuidUtility,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
HookHandler hookHandler,
|
HookHandler hookHandler,
|
||||||
ErrorHandler errorHandler
|
ErrorHandler errorHandler
|
||||||
) {
|
) {
|
||||||
super(uuidUtility, errorHandler);
|
super(uuidUtility, errorHandler);
|
||||||
|
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.hookHandler = hookHandler;
|
this.hookHandler = hookHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,11 +46,11 @@ public class ProxyAPI extends CommonAPI {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPlayerName(UUID uuid) {
|
public String getPlayerName(UUID uuid) {
|
||||||
return database.fetch().getPlayerName(uuid);
|
return dbSystem.getDatabase().fetch().getPlayerName(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FetchOperations fetchFromPlanDB() {
|
public FetchOperations fetchFromPlanDB() {
|
||||||
return database.fetch();
|
return dbSystem.getDatabase().fetch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ package com.djrapitops.plan.api;
|
|||||||
|
|
||||||
import com.djrapitops.plan.data.plugin.HookHandler;
|
import com.djrapitops.plan.data.plugin.HookHandler;
|
||||||
import com.djrapitops.plan.data.plugin.PluginData;
|
import com.djrapitops.plan.data.plugin.PluginData;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
import com.djrapitops.plan.system.database.databases.operation.FetchOperations;
|
import com.djrapitops.plan.system.database.databases.operation.FetchOperations;
|
||||||
import com.djrapitops.plan.utilities.uuid.UUIDUtility;
|
import com.djrapitops.plan.utilities.uuid.UUIDUtility;
|
||||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||||
@ -24,18 +24,18 @@ import java.util.UUID;
|
|||||||
public class ServerAPI extends CommonAPI {
|
public class ServerAPI extends CommonAPI {
|
||||||
|
|
||||||
private final HookHandler hookHandler;
|
private final HookHandler hookHandler;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ServerAPI(
|
public ServerAPI(
|
||||||
UUIDUtility uuidUtility,
|
UUIDUtility uuidUtility,
|
||||||
HookHandler hookHandler,
|
HookHandler hookHandler,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
ErrorHandler errorHandler
|
ErrorHandler errorHandler
|
||||||
) {
|
) {
|
||||||
super(uuidUtility, errorHandler);
|
super(uuidUtility, errorHandler);
|
||||||
this.hookHandler = hookHandler;
|
this.hookHandler = hookHandler;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -45,11 +45,11 @@ public class ServerAPI extends CommonAPI {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPlayerName(UUID uuid) {
|
public String getPlayerName(UUID uuid) {
|
||||||
return database.fetch().getPlayerName(uuid);
|
return dbSystem.getDatabase().fetch().getPlayerName(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FetchOperations fetchFromPlanDB() {
|
public FetchOperations fetchFromPlanDB() {
|
||||||
return database.fetch();
|
return dbSystem.getDatabase().fetch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.djrapitops.plan.command.commands;
|
|||||||
|
|
||||||
import com.djrapitops.plan.api.exceptions.connection.WebException;
|
import com.djrapitops.plan.api.exceptions.connection.WebException;
|
||||||
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
import com.djrapitops.plan.system.info.InfoSystem;
|
import com.djrapitops.plan.system.info.InfoSystem;
|
||||||
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
||||||
import com.djrapitops.plan.system.info.server.Server;
|
import com.djrapitops.plan.system.info.server.Server;
|
||||||
@ -42,7 +42,7 @@ public class AnalyzeCommand extends CommandNode {
|
|||||||
private final InfoSystem infoSystem;
|
private final InfoSystem infoSystem;
|
||||||
private final ServerInfo serverInfo;
|
private final ServerInfo serverInfo;
|
||||||
private final WebServer webServer;
|
private final WebServer webServer;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final ConnectionSystem connectionSystem;
|
private final ConnectionSystem connectionSystem;
|
||||||
private final ErrorHandler errorHandler;
|
private final ErrorHandler errorHandler;
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ public class AnalyzeCommand extends CommandNode {
|
|||||||
InfoSystem infoSystem,
|
InfoSystem infoSystem,
|
||||||
ServerInfo serverInfo,
|
ServerInfo serverInfo,
|
||||||
WebServer webServer,
|
WebServer webServer,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
ErrorHandler errorHandler
|
ErrorHandler errorHandler
|
||||||
) {
|
) {
|
||||||
super("analyze|analyse|analysis|a", Permissions.ANALYZE.getPermission(), CommandType.CONSOLE);
|
super("analyze|analyse|analysis|a", Permissions.ANALYZE.getPermission(), CommandType.CONSOLE);
|
||||||
@ -64,7 +64,7 @@ public class AnalyzeCommand extends CommandNode {
|
|||||||
connectionSystem = infoSystem.getConnectionSystem();
|
connectionSystem = infoSystem.getConnectionSystem();
|
||||||
this.serverInfo = serverInfo;
|
this.serverInfo = serverInfo;
|
||||||
this.webServer = webServer;
|
this.webServer = webServer;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
|
|
||||||
setShortHelp(locale.getString(CmdHelpLang.ANALYZE));
|
setShortHelp(locale.getString(CmdHelpLang.ANALYZE));
|
||||||
@ -110,14 +110,14 @@ public class AnalyzeCommand extends CommandNode {
|
|||||||
private void sendWebUserNotificationIfNecessary(Sender sender) {
|
private void sendWebUserNotificationIfNecessary(Sender sender) {
|
||||||
if (webServer.isAuthRequired() &&
|
if (webServer.isAuthRequired() &&
|
||||||
CommandUtils.isPlayer(sender) &&
|
CommandUtils.isPlayer(sender) &&
|
||||||
!database.check().doesWebUserExists(sender.getName())) {
|
!dbSystem.getDatabase().check().doesWebUserExists(sender.getName())) {
|
||||||
sender.sendMessage("§e" + locale.getString(CommandLang.NO_WEB_USER_NOTIFY));
|
sender.sendMessage("§e" + locale.getString(CommandLang.NO_WEB_USER_NOTIFY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Optional<Server> getServer(String[] args) {
|
private Optional<Server> getServer(String[] args) {
|
||||||
if (args.length >= 1 && connectionSystem.isServerAvailable()) {
|
if (args.length >= 1 && connectionSystem.isServerAvailable()) {
|
||||||
Map<UUID, Server> bukkitServers = database.fetch().getBukkitServers();
|
Map<UUID, Server> bukkitServers = dbSystem.getDatabase().fetch().getBukkitServers();
|
||||||
String serverIdentifier = getGivenIdentifier(args);
|
String serverIdentifier = getGivenIdentifier(args);
|
||||||
for (Map.Entry<UUID, Server> entry : bukkitServers.entrySet()) {
|
for (Map.Entry<UUID, Server> entry : bukkitServers.entrySet()) {
|
||||||
Server server = entry.getValue();
|
Server server = entry.getValue();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.djrapitops.plan.command.commands;
|
package com.djrapitops.plan.command.commands;
|
||||||
|
|
||||||
import com.djrapitops.plan.PlanPlugin;
|
import com.djrapitops.plan.PlanPlugin;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
||||||
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;
|
||||||
@ -25,7 +25,7 @@ public class InfoCommand extends CommandNode {
|
|||||||
|
|
||||||
private final PlanPlugin plugin;
|
private final PlanPlugin plugin;
|
||||||
private final Locale locale;
|
private final Locale locale;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final ConnectionSystem connectionSystem;
|
private final ConnectionSystem connectionSystem;
|
||||||
private final VersionCheckSystem versionCheckSystem;
|
private final VersionCheckSystem versionCheckSystem;
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ public class InfoCommand extends CommandNode {
|
|||||||
public InfoCommand(
|
public InfoCommand(
|
||||||
PlanPlugin plugin,
|
PlanPlugin plugin,
|
||||||
Locale locale,
|
Locale locale,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
ConnectionSystem connectionSystem,
|
ConnectionSystem connectionSystem,
|
||||||
VersionCheckSystem versionCheckSystem
|
VersionCheckSystem versionCheckSystem
|
||||||
) {
|
) {
|
||||||
@ -41,7 +41,7 @@ public class InfoCommand extends CommandNode {
|
|||||||
|
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.connectionSystem = connectionSystem;
|
this.connectionSystem = connectionSystem;
|
||||||
this.versionCheckSystem = versionCheckSystem;
|
this.versionCheckSystem = versionCheckSystem;
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ public class InfoCommand extends CommandNode {
|
|||||||
"",
|
"",
|
||||||
locale.getString(CommandLang.INFO_VERSION, plugin.getVersion()),
|
locale.getString(CommandLang.INFO_VERSION, plugin.getVersion()),
|
||||||
locale.getString(CommandLang.INFO_UPDATE, updateAvailable),
|
locale.getString(CommandLang.INFO_UPDATE, updateAvailable),
|
||||||
locale.getString(CommandLang.INFO_DATABASE, database.getName()),
|
locale.getString(CommandLang.INFO_DATABASE, dbSystem.getDatabase().getName()),
|
||||||
locale.getString(CommandLang.INFO_BUNGEE_CONNECTION, connectedToBungee),
|
locale.getString(CommandLang.INFO_BUNGEE_CONNECTION, connectedToBungee),
|
||||||
"",
|
"",
|
||||||
">"
|
">"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.djrapitops.plan.command.commands;
|
package com.djrapitops.plan.command.commands;
|
||||||
|
|
||||||
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
||||||
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;
|
||||||
@ -32,7 +32,7 @@ import java.util.UUID;
|
|||||||
public class InspectCommand extends CommandNode {
|
public class InspectCommand extends CommandNode {
|
||||||
|
|
||||||
private final Locale locale;
|
private final Locale locale;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final WebServer webServer;
|
private final WebServer webServer;
|
||||||
private final InfoProcessors processorFactory;
|
private final InfoProcessors processorFactory;
|
||||||
private final Processing processing;
|
private final Processing processing;
|
||||||
@ -45,7 +45,7 @@ public class InspectCommand extends CommandNode {
|
|||||||
Locale locale,
|
Locale locale,
|
||||||
InfoProcessors processorFactory,
|
InfoProcessors processorFactory,
|
||||||
Processing processing,
|
Processing processing,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
WebServer webServer,
|
WebServer webServer,
|
||||||
ConnectionSystem connectionSystem,
|
ConnectionSystem connectionSystem,
|
||||||
UUIDUtility uuidUtility,
|
UUIDUtility uuidUtility,
|
||||||
@ -58,7 +58,7 @@ public class InspectCommand extends CommandNode {
|
|||||||
setArguments("<player>");
|
setArguments("<player>");
|
||||||
|
|
||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.webServer = webServer;
|
this.webServer = webServer;
|
||||||
this.uuidUtility = uuidUtility;
|
this.uuidUtility = uuidUtility;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
@ -87,7 +87,7 @@ public class InspectCommand extends CommandNode {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!database.check().isPlayerRegistered(uuid)) {
|
if (!dbSystem.getDatabase().check().isPlayerRegistered(uuid)) {
|
||||||
sender.sendMessage(locale.getString(CommandLang.FAIL_USERNAME_NOT_KNOWN));
|
sender.sendMessage(locale.getString(CommandLang.FAIL_USERNAME_NOT_KNOWN));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ public class InspectCommand extends CommandNode {
|
|||||||
|
|
||||||
private void checkWebUserAndNotify(Sender sender) {
|
private void checkWebUserAndNotify(Sender sender) {
|
||||||
if (CommandUtils.isPlayer(sender) && webServer.isAuthRequired()) {
|
if (CommandUtils.isPlayer(sender) && webServer.isAuthRequired()) {
|
||||||
boolean senderHasWebUser = database.check().doesWebUserExists(sender.getName());
|
boolean senderHasWebUser = dbSystem.getDatabase().check().doesWebUserExists(sender.getName());
|
||||||
|
|
||||||
if (!senderHasWebUser) {
|
if (!senderHasWebUser) {
|
||||||
sender.sendMessage("§e" + locale.getString(CommandLang.NO_WEB_USER_NOTIFY));
|
sender.sendMessage("§e" + locale.getString(CommandLang.NO_WEB_USER_NOTIFY));
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.djrapitops.plan.command.commands;
|
package com.djrapitops.plan.command.commands;
|
||||||
|
|
||||||
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
import com.djrapitops.plan.system.info.server.Server;
|
import com.djrapitops.plan.system.info.server.Server;
|
||||||
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;
|
||||||
@ -28,16 +28,21 @@ public class ListServersCommand extends CommandNode {
|
|||||||
|
|
||||||
private final Locale locale;
|
private final Locale locale;
|
||||||
private final ColorScheme colorScheme;
|
private final ColorScheme colorScheme;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final ErrorHandler errorHandler;
|
private final ErrorHandler errorHandler;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ListServersCommand(Locale locale, ColorScheme colorScheme, Database database, ErrorHandler errorHandler) {
|
public ListServersCommand(
|
||||||
|
Locale locale,
|
||||||
|
ColorScheme colorScheme,
|
||||||
|
DBSystem dbSystem,
|
||||||
|
ErrorHandler errorHandler
|
||||||
|
) {
|
||||||
super("servers|serverlist|listservers|sl|ls", Permissions.MANAGE.getPermission(), CommandType.CONSOLE);
|
super("servers|serverlist|listservers|sl|ls", Permissions.MANAGE.getPermission(), CommandType.CONSOLE);
|
||||||
|
|
||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
this.colorScheme = colorScheme;
|
this.colorScheme = colorScheme;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
|
|
||||||
setShortHelp(locale.getString(CmdHelpLang.SERVERS));
|
setShortHelp(locale.getString(CmdHelpLang.SERVERS));
|
||||||
@ -60,7 +65,7 @@ public class ListServersCommand extends CommandNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendServers(Sender sender, Formatter<Server> serverFormatter) {
|
private void sendServers(Sender sender, Formatter<Server> serverFormatter) {
|
||||||
List<Server> servers = database.fetch().getServers();
|
List<Server> servers = dbSystem.getDatabase().fetch().getServers();
|
||||||
for (Server server : servers) {
|
for (Server server : servers) {
|
||||||
sender.sendMessage(serverFormatter.apply(server));
|
sender.sendMessage(serverFormatter.apply(server));
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import com.djrapitops.plan.data.store.mutators.ActivityIndex;
|
|||||||
import com.djrapitops.plan.data.store.mutators.GeoInfoMutator;
|
import com.djrapitops.plan.data.store.mutators.GeoInfoMutator;
|
||||||
import com.djrapitops.plan.data.store.mutators.SessionsMutator;
|
import com.djrapitops.plan.data.store.mutators.SessionsMutator;
|
||||||
import com.djrapitops.plan.data.store.objects.DateHolder;
|
import com.djrapitops.plan.data.store.objects.DateHolder;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
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;
|
||||||
@ -45,7 +45,7 @@ import java.util.UUID;
|
|||||||
public class QInspectCommand extends CommandNode {
|
public class QInspectCommand extends CommandNode {
|
||||||
|
|
||||||
private final Locale locale;
|
private final Locale locale;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final PlanConfig config;
|
private final PlanConfig config;
|
||||||
private final Processing processing;
|
private final Processing processing;
|
||||||
private final Formatters formatters;
|
private final Formatters formatters;
|
||||||
@ -57,7 +57,7 @@ public class QInspectCommand extends CommandNode {
|
|||||||
PlanConfig config,
|
PlanConfig config,
|
||||||
Locale locale,
|
Locale locale,
|
||||||
Processing processing,
|
Processing processing,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
UUIDUtility uuidUtility,
|
UUIDUtility uuidUtility,
|
||||||
Formatters formatters,
|
Formatters formatters,
|
||||||
ErrorHandler errorHandler
|
ErrorHandler errorHandler
|
||||||
@ -69,7 +69,7 @@ public class QInspectCommand extends CommandNode {
|
|||||||
setArguments("<player>");
|
setArguments("<player>");
|
||||||
|
|
||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.uuidUtility = uuidUtility;
|
this.uuidUtility = uuidUtility;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ public class QInspectCommand extends CommandNode {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerContainer container = database.fetch().getPlayerContainer(uuid);
|
PlayerContainer container = dbSystem.getDatabase().fetch().getPlayerContainer(uuid);
|
||||||
if (!container.getValue(PlayerKeys.REGISTERED).isPresent()) {
|
if (!container.getValue(PlayerKeys.REGISTERED).isPresent()) {
|
||||||
sender.sendMessage(locale.getString(CommandLang.FAIL_USERNAME_NOT_KNOWN));
|
sender.sendMessage(locale.getString(CommandLang.FAIL_USERNAME_NOT_KNOWN));
|
||||||
return;
|
return;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.djrapitops.plan.command.commands;
|
package com.djrapitops.plan.command.commands;
|
||||||
|
|
||||||
import com.djrapitops.plan.data.WebUser;
|
import com.djrapitops.plan.data.WebUser;
|
||||||
|
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.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;
|
||||||
@ -40,7 +41,7 @@ public class RegisterCommand extends CommandNode {
|
|||||||
private final String notEnoughArgsMsg;
|
private final String notEnoughArgsMsg;
|
||||||
private final Locale locale;
|
private final Locale locale;
|
||||||
private final Processing processing;
|
private final Processing processing;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final PluginLogger logger;
|
private final PluginLogger logger;
|
||||||
private final ErrorHandler errorHandler;
|
private final ErrorHandler errorHandler;
|
||||||
|
|
||||||
@ -48,16 +49,17 @@ public class RegisterCommand extends CommandNode {
|
|||||||
public RegisterCommand(
|
public RegisterCommand(
|
||||||
Locale locale,
|
Locale locale,
|
||||||
Processing processing,
|
Processing processing,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
PluginLogger logger,
|
PluginLogger logger,
|
||||||
ErrorHandler errorHandler) {
|
ErrorHandler errorHandler
|
||||||
|
) {
|
||||||
// No Permission Requirement
|
// No Permission Requirement
|
||||||
super("register", "", CommandType.PLAYER_OR_ARGS);
|
super("register", "", CommandType.PLAYER_OR_ARGS);
|
||||||
|
|
||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
this.processing = processing;
|
this.processing = processing;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
|
|
||||||
setArguments("<password>", "[name]", "[lvl]");
|
setArguments("<password>", "[name]", "[lvl]");
|
||||||
@ -131,6 +133,7 @@ public class RegisterCommand extends CommandNode {
|
|||||||
processing.submitCritical(() -> {
|
processing.submitCritical(() -> {
|
||||||
String userName = webUser.getName();
|
String userName = webUser.getName();
|
||||||
try {
|
try {
|
||||||
|
Database database = dbSystem.getDatabase();
|
||||||
boolean userExists = database.check().doesWebUserExists(userName);
|
boolean userExists = database.check().doesWebUserExists(userName);
|
||||||
if (userExists) {
|
if (userExists) {
|
||||||
sender.sendMessage(locale.getString(CommandLang.FAIL_WEB_USER_EXISTS));
|
sender.sendMessage(locale.getString(CommandLang.FAIL_WEB_USER_EXISTS));
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.djrapitops.plan.command.commands;
|
package com.djrapitops.plan.command.commands;
|
||||||
|
|
||||||
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
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;
|
||||||
@ -33,20 +33,20 @@ public class SearchCommand extends CommandNode {
|
|||||||
|
|
||||||
private final Locale locale;
|
private final Locale locale;
|
||||||
private final Processing processing;
|
private final Processing processing;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final ErrorHandler errorHandler;
|
private final ErrorHandler errorHandler;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public SearchCommand(
|
public SearchCommand(
|
||||||
Locale locale,
|
Locale locale,
|
||||||
Processing processing,
|
Processing processing,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
ErrorHandler errorHandler) {
|
ErrorHandler errorHandler) {
|
||||||
super("search", Permissions.SEARCH.getPermission(), CommandType.PLAYER_OR_ARGS);
|
super("search", Permissions.SEARCH.getPermission(), CommandType.PLAYER_OR_ARGS);
|
||||||
|
|
||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
this.processing = processing;
|
this.processing = processing;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
|
|
||||||
setArguments("<text>");
|
setArguments("<text>");
|
||||||
@ -68,7 +68,7 @@ public class SearchCommand extends CommandNode {
|
|||||||
processing.submitNonCritical(() -> {
|
processing.submitNonCritical(() -> {
|
||||||
try {
|
try {
|
||||||
String searchTerm = args[0];
|
String searchTerm = args[0];
|
||||||
List<String> names = database.search().matchingPlayers(searchTerm);
|
List<String> names = dbSystem.getDatabase().search().matchingPlayers(searchTerm);
|
||||||
Collections.sort(names);
|
Collections.sort(names);
|
||||||
boolean empty = Verify.isEmpty(names);
|
boolean empty = Verify.isEmpty(names);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.djrapitops.plan.command.commands.manage;
|
package com.djrapitops.plan.command.commands.manage;
|
||||||
|
|
||||||
import com.djrapitops.plan.api.exceptions.connection.*;
|
import com.djrapitops.plan.api.exceptions.connection.*;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
||||||
import com.djrapitops.plan.system.info.request.InfoRequestFactory;
|
import com.djrapitops.plan.system.info.request.InfoRequestFactory;
|
||||||
import com.djrapitops.plan.system.info.server.Server;
|
import com.djrapitops.plan.system.info.server.Server;
|
||||||
@ -41,7 +41,7 @@ public class ManageConDebugCommand extends CommandNode {
|
|||||||
private final ConnectionSystem connectionSystem;
|
private final ConnectionSystem connectionSystem;
|
||||||
private final InfoRequestFactory infoRequestFactory;
|
private final InfoRequestFactory infoRequestFactory;
|
||||||
private final WebServer webServer;
|
private final WebServer webServer;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ManageConDebugCommand(
|
public ManageConDebugCommand(
|
||||||
@ -52,7 +52,7 @@ public class ManageConDebugCommand extends CommandNode {
|
|||||||
ConnectionSystem connectionSystem,
|
ConnectionSystem connectionSystem,
|
||||||
InfoRequestFactory infoRequestFactory,
|
InfoRequestFactory infoRequestFactory,
|
||||||
WebServer webServer,
|
WebServer webServer,
|
||||||
Database database
|
DBSystem dbSystem
|
||||||
) {
|
) {
|
||||||
super("con", Permissions.MANAGE.getPermission(), CommandType.ALL);
|
super("con", Permissions.MANAGE.getPermission(), CommandType.ALL);
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ public class ManageConDebugCommand extends CommandNode {
|
|||||||
this.connectionSystem = connectionSystem;
|
this.connectionSystem = connectionSystem;
|
||||||
this.infoRequestFactory = infoRequestFactory;
|
this.infoRequestFactory = infoRequestFactory;
|
||||||
this.webServer = webServer;
|
this.webServer = webServer;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
|
|
||||||
setShortHelp(locale.getString(Check.isBungeeAvailable() ? CmdHelpLang.CON : CmdHelpLang.MANAGE_CON));
|
setShortHelp(locale.getString(Check.isBungeeAvailable() ? CmdHelpLang.CON : CmdHelpLang.MANAGE_CON));
|
||||||
setInDepthHelp(locale.getArray(DeepHelpLang.MANAGE_CON));
|
setInDepthHelp(locale.getArray(DeepHelpLang.MANAGE_CON));
|
||||||
@ -114,7 +114,7 @@ public class ManageConDebugCommand extends CommandNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void testServers(Sender sender) {
|
private void testServers(Sender sender) {
|
||||||
List<Server> servers = database.fetch().getServers();
|
List<Server> servers = dbSystem.getDatabase().fetch().getServers();
|
||||||
|
|
||||||
if (servers.isEmpty()) {
|
if (servers.isEmpty()) {
|
||||||
sender.sendMessage(locale.getString(ManageLang.CON_NO_SERVERS));
|
sender.sendMessage(locale.getString(ManageLang.CON_NO_SERVERS));
|
||||||
|
@ -61,7 +61,7 @@ public class ManageHotSwapCommand extends CommandNode {
|
|||||||
Verify.isTrue(isCorrectDB,
|
Verify.isTrue(isCorrectDB,
|
||||||
() -> new IllegalArgumentException(locale.getString(ManageLang.FAIL_INCORRECT_DB, dbName)));
|
() -> new IllegalArgumentException(locale.getString(ManageLang.FAIL_INCORRECT_DB, dbName)));
|
||||||
|
|
||||||
Verify.isFalse(dbName.equals(dbSystem.getActiveDatabase().getConfigName()),
|
Verify.isFalse(dbName.equals(dbSystem.getDatabase().getConfigName()),
|
||||||
() -> new IllegalArgumentException(locale.getString(ManageLang.FAIL_SAME_DB)));
|
() -> new IllegalArgumentException(locale.getString(ManageLang.FAIL_SAME_DB)));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -99,7 +99,7 @@ public class ManageMoveCommand extends CommandNode {
|
|||||||
|
|
||||||
sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
||||||
|
|
||||||
boolean movingToCurrentDB = toDatabase.getConfigName().equalsIgnoreCase(dbSystem.getActiveDatabase().getConfigName());
|
boolean movingToCurrentDB = toDatabase.getConfigName().equalsIgnoreCase(dbSystem.getDatabase().getConfigName());
|
||||||
if (movingToCurrentDB) {
|
if (movingToCurrentDB) {
|
||||||
sender.sendMessage(locale.getString(ManageLang.HOTSWAP_REMINDER, toDatabase.getConfigName()));
|
sender.sendMessage(locale.getString(ManageLang.HOTSWAP_REMINDER, toDatabase.getConfigName()));
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.djrapitops.plan.command.commands.manage;
|
package com.djrapitops.plan.command.commands.manage;
|
||||||
|
|
||||||
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
||||||
|
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.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;
|
||||||
@ -25,7 +26,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This manage subcommand is used to remove a single player's data from the
|
* This manage subcommand is used to remove a single player's data from the
|
||||||
* database.
|
* dbSystem.
|
||||||
*
|
*
|
||||||
* @author Rsl1122
|
* @author Rsl1122
|
||||||
*/
|
*/
|
||||||
@ -34,7 +35,7 @@ public class ManageRemoveCommand extends CommandNode {
|
|||||||
|
|
||||||
private final Locale locale;
|
private final Locale locale;
|
||||||
private final Processing processing;
|
private final Processing processing;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final UUIDUtility uuidUtility;
|
private final UUIDUtility uuidUtility;
|
||||||
private final ErrorHandler errorHandler;
|
private final ErrorHandler errorHandler;
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ public class ManageRemoveCommand extends CommandNode {
|
|||||||
public ManageRemoveCommand(
|
public ManageRemoveCommand(
|
||||||
Locale locale,
|
Locale locale,
|
||||||
Processing processing,
|
Processing processing,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
UUIDUtility uuidUtility,
|
UUIDUtility uuidUtility,
|
||||||
ErrorHandler errorHandler
|
ErrorHandler errorHandler
|
||||||
) {
|
) {
|
||||||
@ -50,7 +51,7 @@ public class ManageRemoveCommand extends CommandNode {
|
|||||||
|
|
||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
this.processing = processing;
|
this.processing = processing;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.uuidUtility = uuidUtility;
|
this.uuidUtility = uuidUtility;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
|
|
||||||
@ -84,19 +85,24 @@ public class ManageRemoveCommand extends CommandNode {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!database.check().isPlayerRegistered(uuid)) {
|
Database db = dbSystem.getDatabase();
|
||||||
|
if (!db.check().isPlayerRegistered(uuid)) {
|
||||||
sender.sendMessage(locale.getString(CommandLang.FAIL_USERNAME_NOT_KNOWN));
|
sender.sendMessage(locale.getString(CommandLang.FAIL_USERNAME_NOT_KNOWN));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Verify.contains("-a", args)) {
|
if (!Verify.contains("-a", args)) {
|
||||||
sender.sendMessage(locale.getString(ManageLang.CONFIRMATION, locale.getString(ManageLang.CONFIRM_REMOVAL, database.getName())));
|
sender.sendMessage(
|
||||||
|
locale.getString(ManageLang.CONFIRMATION,
|
||||||
|
locale.getString(ManageLang.CONFIRM_REMOVAL, db.getName())
|
||||||
|
)
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(locale.getString(ManageLang.PROGRESS_START));
|
sender.sendMessage(locale.getString(ManageLang.PROGRESS_START));
|
||||||
|
|
||||||
database.remove().player(uuid);
|
db.remove().player(uuid);
|
||||||
|
|
||||||
sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
||||||
} catch (DBOpException e) {
|
} catch (DBOpException e) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.djrapitops.plan.command.commands.manage;
|
package com.djrapitops.plan.command.commands.manage;
|
||||||
|
|
||||||
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
import com.djrapitops.plan.system.info.server.Server;
|
import com.djrapitops.plan.system.info.server.Server;
|
||||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||||
import com.djrapitops.plan.system.locale.Locale;
|
import com.djrapitops.plan.system.locale.Locale;
|
||||||
@ -33,7 +33,7 @@ public class ManageUninstalledCommand extends CommandNode {
|
|||||||
|
|
||||||
private final Locale locale;
|
private final Locale locale;
|
||||||
private final Processing processing;
|
private final Processing processing;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final ErrorHandler errorHandler;
|
private final ErrorHandler errorHandler;
|
||||||
private final ServerInfo serverInfo;
|
private final ServerInfo serverInfo;
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ public class ManageUninstalledCommand extends CommandNode {
|
|||||||
public ManageUninstalledCommand(
|
public ManageUninstalledCommand(
|
||||||
Locale locale,
|
Locale locale,
|
||||||
Processing processing,
|
Processing processing,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
ServerInfo serverInfo,
|
ServerInfo serverInfo,
|
||||||
ErrorHandler errorHandler
|
ErrorHandler errorHandler
|
||||||
) {
|
) {
|
||||||
@ -49,7 +49,7 @@ public class ManageUninstalledCommand extends CommandNode {
|
|||||||
|
|
||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
this.processing = processing;
|
this.processing = processing;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.serverInfo = serverInfo;
|
this.serverInfo = serverInfo;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ public class ManageUninstalledCommand extends CommandNode {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
database.save().setAsUninstalled(serverUUID);
|
dbSystem.getDatabase().save().setAsUninstalled(serverUUID);
|
||||||
sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
||||||
} catch (DBOpException e) {
|
} catch (DBOpException e) {
|
||||||
sender.sendMessage("§cError occurred: " + e.toString());
|
sender.sendMessage("§cError occurred: " + e.toString());
|
||||||
@ -87,7 +87,7 @@ public class ManageUninstalledCommand extends CommandNode {
|
|||||||
|
|
||||||
private Optional<Server> getServer(String[] args) {
|
private Optional<Server> getServer(String[] args) {
|
||||||
if (args.length >= 1) {
|
if (args.length >= 1) {
|
||||||
Map<UUID, Server> bukkitServers = database.fetch().getBukkitServers();
|
Map<UUID, Server> bukkitServers = dbSystem.getDatabase().fetch().getBukkitServers();
|
||||||
String serverIdentifier = getGivenIdentifier(args);
|
String serverIdentifier = getGivenIdentifier(args);
|
||||||
for (Map.Entry<UUID, Server> entry : bukkitServers.entrySet()) {
|
for (Map.Entry<UUID, Server> entry : bukkitServers.entrySet()) {
|
||||||
Server server = entry.getValue();
|
Server server = entry.getValue();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.djrapitops.plan.command.commands.webuser;
|
package com.djrapitops.plan.command.commands.webuser;
|
||||||
|
|
||||||
import com.djrapitops.plan.data.WebUser;
|
import com.djrapitops.plan.data.WebUser;
|
||||||
|
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.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;
|
||||||
@ -30,20 +31,21 @@ public class WebCheckCommand extends CommandNode {
|
|||||||
|
|
||||||
private final Locale locale;
|
private final Locale locale;
|
||||||
private final Processing processing;
|
private final Processing processing;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final ErrorHandler errorHandler;
|
private final ErrorHandler errorHandler;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public WebCheckCommand(
|
public WebCheckCommand(
|
||||||
Locale locale,
|
Locale locale,
|
||||||
Processing processing,
|
Processing processing,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
ErrorHandler errorHandler) {
|
ErrorHandler errorHandler
|
||||||
|
) {
|
||||||
super("check", Permissions.MANAGE_WEB.getPerm(), CommandType.PLAYER_OR_ARGS);
|
super("check", Permissions.MANAGE_WEB.getPerm(), CommandType.PLAYER_OR_ARGS);
|
||||||
|
|
||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
this.processing = processing;
|
this.processing = processing;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
|
|
||||||
setShortHelp(locale.getString(CmdHelpLang.WEB_CHECK));
|
setShortHelp(locale.getString(CmdHelpLang.WEB_CHECK));
|
||||||
@ -59,11 +61,12 @@ public class WebCheckCommand extends CommandNode {
|
|||||||
|
|
||||||
processing.submitNonCritical(() -> {
|
processing.submitNonCritical(() -> {
|
||||||
try {
|
try {
|
||||||
if (!database.check().doesWebUserExists(user)) {
|
Database db = dbSystem.getDatabase();
|
||||||
|
if (!db.check().doesWebUserExists(user)) {
|
||||||
sender.sendMessage(locale.getString(CommandLang.FAIL_WEB_USER_NOT_EXISTS));
|
sender.sendMessage(locale.getString(CommandLang.FAIL_WEB_USER_NOT_EXISTS));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WebUser info = database.fetch().getWebUser(user);
|
WebUser info = db.fetch().getWebUser(user);
|
||||||
sender.sendMessage(locale.getString(CommandLang.WEB_USER_LIST, info.getName(), info.getPermLevel()));
|
sender.sendMessage(locale.getString(CommandLang.WEB_USER_LIST, info.getName(), info.getPermLevel()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.djrapitops.plan.command.commands.webuser;
|
package com.djrapitops.plan.command.commands.webuser;
|
||||||
|
|
||||||
|
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.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;
|
||||||
@ -29,21 +30,21 @@ public class WebDeleteCommand extends CommandNode {
|
|||||||
|
|
||||||
private final Locale locale;
|
private final Locale locale;
|
||||||
private final Processing processing;
|
private final Processing processing;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final ErrorHandler errorHandler;
|
private final ErrorHandler errorHandler;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public WebDeleteCommand(
|
public WebDeleteCommand(
|
||||||
Locale locale,
|
Locale locale,
|
||||||
Processing processing,
|
Processing processing,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
ErrorHandler errorHandler
|
ErrorHandler errorHandler
|
||||||
) {
|
) {
|
||||||
super("delete|remove", Permissions.MANAGE_WEB.getPerm(), CommandType.PLAYER_OR_ARGS);
|
super("delete|remove", Permissions.MANAGE_WEB.getPerm(), CommandType.PLAYER_OR_ARGS);
|
||||||
|
|
||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
this.processing = processing;
|
this.processing = processing;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
|
|
||||||
setShortHelp(locale.getString(CmdHelpLang.WEB_DELETE));
|
setShortHelp(locale.getString(CmdHelpLang.WEB_DELETE));
|
||||||
@ -59,11 +60,12 @@ public class WebDeleteCommand extends CommandNode {
|
|||||||
|
|
||||||
processing.submitNonCritical(() -> {
|
processing.submitNonCritical(() -> {
|
||||||
try {
|
try {
|
||||||
if (!database.check().doesWebUserExists(user)) {
|
Database db = dbSystem.getDatabase();
|
||||||
|
if (!db.check().doesWebUserExists(user)) {
|
||||||
sender.sendMessage("§c[Plan] User Doesn't exist.");
|
sender.sendMessage("§c[Plan] User Doesn't exist.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
database.remove().webUser(user);
|
db.remove().webUser(user);
|
||||||
sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.djrapitops.plan.command.commands.webuser;
|
package com.djrapitops.plan.command.commands.webuser;
|
||||||
|
|
||||||
import com.djrapitops.plan.data.WebUser;
|
import com.djrapitops.plan.data.WebUser;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
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;
|
||||||
@ -30,21 +30,21 @@ public class WebListUsersCommand extends CommandNode {
|
|||||||
|
|
||||||
private final Locale locale;
|
private final Locale locale;
|
||||||
private final Processing processing;
|
private final Processing processing;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final ErrorHandler errorHandler;
|
private final ErrorHandler errorHandler;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public WebListUsersCommand(
|
public WebListUsersCommand(
|
||||||
Locale locale,
|
Locale locale,
|
||||||
Processing processing,
|
Processing processing,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
ErrorHandler errorHandler
|
ErrorHandler errorHandler
|
||||||
) {
|
) {
|
||||||
super("list", Permissions.MANAGE_WEB.getPerm(), CommandType.CONSOLE);
|
super("list", Permissions.MANAGE_WEB.getPerm(), CommandType.CONSOLE);
|
||||||
|
|
||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
this.processing = processing;
|
this.processing = processing;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
|
|
||||||
setShortHelp(locale.getString(CmdHelpLang.WEB_LIST));
|
setShortHelp(locale.getString(CmdHelpLang.WEB_LIST));
|
||||||
@ -54,7 +54,7 @@ public class WebListUsersCommand extends CommandNode {
|
|||||||
public void onCommand(Sender sender, String commandLabel, String[] args) {
|
public void onCommand(Sender sender, String commandLabel, String[] args) {
|
||||||
processing.submitNonCritical(() -> {
|
processing.submitNonCritical(() -> {
|
||||||
try {
|
try {
|
||||||
List<WebUser> users = database.fetch().getWebUsers();
|
List<WebUser> users = dbSystem.getDatabase().fetch().getWebUsers();
|
||||||
users.sort(new WebUserComparator());
|
users.sort(new WebUserComparator());
|
||||||
sender.sendMessage(locale.getString(CommandLang.HEADER_WEB_USERS, users.size()));
|
sender.sendMessage(locale.getString(CommandLang.HEADER_WEB_USERS, users.size()));
|
||||||
for (WebUser user : users) {
|
for (WebUser user : users) {
|
||||||
|
@ -8,7 +8,7 @@ import com.djrapitops.plan.data.store.keys.ServerKeys;
|
|||||||
import com.djrapitops.plan.data.store.mutators.*;
|
import com.djrapitops.plan.data.store.mutators.*;
|
||||||
import com.djrapitops.plan.data.store.mutators.health.HealthInformation;
|
import com.djrapitops.plan.data.store.mutators.health.HealthInformation;
|
||||||
import com.djrapitops.plan.data.time.WorldTimes;
|
import com.djrapitops.plan.data.time.WorldTimes;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
import com.djrapitops.plan.system.info.server.properties.ServerProperties;
|
import com.djrapitops.plan.system.info.server.properties.ServerProperties;
|
||||||
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 AnalysisContainer extends DataContainer {
|
|||||||
private final String version;
|
private final String version;
|
||||||
private final PlanConfig config;
|
private final PlanConfig config;
|
||||||
private final Theme theme;
|
private final Theme theme;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final ServerProperties serverProperties;
|
private final ServerProperties serverProperties;
|
||||||
private final Formatters formatters;
|
private final Formatters formatters;
|
||||||
private final Graphs graphs;
|
private final Graphs graphs;
|
||||||
@ -63,7 +63,7 @@ public class AnalysisContainer extends DataContainer {
|
|||||||
String version,
|
String version,
|
||||||
PlanConfig config,
|
PlanConfig config,
|
||||||
Theme theme,
|
Theme theme,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
ServerProperties serverProperties,
|
ServerProperties serverProperties,
|
||||||
Formatters formatters,
|
Formatters formatters,
|
||||||
Graphs graphs,
|
Graphs graphs,
|
||||||
@ -75,7 +75,7 @@ public class AnalysisContainer extends DataContainer {
|
|||||||
this.version = version;
|
this.version = version;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.theme = theme;
|
this.theme = theme;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.serverProperties = serverProperties;
|
this.serverProperties = serverProperties;
|
||||||
this.formatters = formatters;
|
this.formatters = formatters;
|
||||||
this.graphs = graphs;
|
this.graphs = graphs;
|
||||||
@ -283,7 +283,7 @@ public class AnalysisContainer extends DataContainer {
|
|||||||
|
|
||||||
private void addSessionSuppliers() {
|
private void addSessionSuppliers() {
|
||||||
Key<SessionAccordion> sessionAccordion = new Key<>(SessionAccordion.class, "SESSION_ACCORDION");
|
Key<SessionAccordion> sessionAccordion = new Key<>(SessionAccordion.class, "SESSION_ACCORDION");
|
||||||
putCachingSupplier(serverNames, () -> database.fetch().getServerNames());
|
putCachingSupplier(serverNames, () -> dbSystem.getDatabase().fetch().getServerNames());
|
||||||
putCachingSupplier(sessionAccordion, () -> accordions.serverSessionAccordion(
|
putCachingSupplier(sessionAccordion, () -> accordions.serverSessionAccordion(
|
||||||
getUnsafe(AnalysisKeys.SESSIONS_MUTATOR).all(),
|
getUnsafe(AnalysisKeys.SESSIONS_MUTATOR).all(),
|
||||||
getSupplier(serverNames),
|
getSupplier(serverNames),
|
||||||
@ -471,7 +471,7 @@ public class AnalysisContainer extends DataContainer {
|
|||||||
private final String version;
|
private final String version;
|
||||||
private final PlanConfig config;
|
private final PlanConfig config;
|
||||||
private final Theme theme;
|
private final Theme theme;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final ServerProperties serverProperties;
|
private final ServerProperties serverProperties;
|
||||||
private final Formatters formatters;
|
private final Formatters formatters;
|
||||||
private final Graphs graphs;
|
private final Graphs graphs;
|
||||||
@ -484,7 +484,7 @@ public class AnalysisContainer extends DataContainer {
|
|||||||
@Named("currentVersion") String version,
|
@Named("currentVersion") String version,
|
||||||
PlanConfig config,
|
PlanConfig config,
|
||||||
Theme theme,
|
Theme theme,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
ServerProperties serverProperties,
|
ServerProperties serverProperties,
|
||||||
Formatters formatters,
|
Formatters formatters,
|
||||||
Graphs graphs,
|
Graphs graphs,
|
||||||
@ -495,7 +495,7 @@ public class AnalysisContainer extends DataContainer {
|
|||||||
this.version = version;
|
this.version = version;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.theme = theme;
|
this.theme = theme;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.serverProperties = serverProperties;
|
this.serverProperties = serverProperties;
|
||||||
this.formatters = formatters;
|
this.formatters = formatters;
|
||||||
this.graphs = graphs;
|
this.graphs = graphs;
|
||||||
@ -510,7 +510,7 @@ public class AnalysisContainer extends DataContainer {
|
|||||||
version,
|
version,
|
||||||
config,
|
config,
|
||||||
theme,
|
theme,
|
||||||
database,
|
dbSystem,
|
||||||
serverProperties,
|
serverProperties,
|
||||||
formatters,
|
formatters,
|
||||||
graphs,
|
graphs,
|
||||||
|
@ -7,7 +7,7 @@ import com.djrapitops.plan.data.store.keys.ServerKeys;
|
|||||||
import com.djrapitops.plan.data.store.mutators.PlayersMutator;
|
import com.djrapitops.plan.data.store.mutators.PlayersMutator;
|
||||||
import com.djrapitops.plan.data.store.mutators.TPSMutator;
|
import com.djrapitops.plan.data.store.mutators.TPSMutator;
|
||||||
import com.djrapitops.plan.data.store.mutators.health.NetworkHealthInformation;
|
import com.djrapitops.plan.data.store.mutators.health.NetworkHealthInformation;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
import com.djrapitops.plan.system.info.server.properties.ServerProperties;
|
import com.djrapitops.plan.system.info.server.properties.ServerProperties;
|
||||||
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;
|
||||||
@ -45,7 +45,7 @@ public class NetworkContainer extends DataContainer {
|
|||||||
private final String version;
|
private final String version;
|
||||||
private final PlanConfig config;
|
private final PlanConfig config;
|
||||||
private final Theme theme;
|
private final Theme theme;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final ServerProperties serverProperties;
|
private final ServerProperties serverProperties;
|
||||||
private final Formatters formatters;
|
private final Formatters formatters;
|
||||||
private final Graphs graphs;
|
private final Graphs graphs;
|
||||||
@ -55,7 +55,7 @@ public class NetworkContainer extends DataContainer {
|
|||||||
String version,
|
String version,
|
||||||
PlanConfig config,
|
PlanConfig config,
|
||||||
Theme theme,
|
Theme theme,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
ServerProperties serverProperties,
|
ServerProperties serverProperties,
|
||||||
Formatters formatters,
|
Formatters formatters,
|
||||||
Graphs graphs
|
Graphs graphs
|
||||||
@ -64,7 +64,7 @@ public class NetworkContainer extends DataContainer {
|
|||||||
this.version = version;
|
this.version = version;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.theme = theme;
|
this.theme = theme;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.serverProperties = serverProperties;
|
this.serverProperties = serverProperties;
|
||||||
this.formatters = formatters;
|
this.formatters = formatters;
|
||||||
this.graphs = graphs;
|
this.graphs = graphs;
|
||||||
@ -78,7 +78,7 @@ public class NetworkContainer extends DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addServerBoxes() {
|
private void addServerBoxes() {
|
||||||
putSupplier(NetworkKeys.NETWORK_PLAYER_ONLINE_DATA, () -> database.fetch().getPlayersOnlineForServers(
|
putSupplier(NetworkKeys.NETWORK_PLAYER_ONLINE_DATA, () -> dbSystem.getDatabase().fetch().getPlayersOnlineForServers(
|
||||||
getValue(NetworkKeys.BUKKIT_SERVERS).orElse(new ArrayList<>()))
|
getValue(NetworkKeys.BUKKIT_SERVERS).orElse(new ArrayList<>()))
|
||||||
);
|
);
|
||||||
putSupplier(NetworkKeys.SERVERS_TAB, () -> {
|
putSupplier(NetworkKeys.SERVERS_TAB, () -> {
|
||||||
@ -213,7 +213,7 @@ public class NetworkContainer extends DataContainer {
|
|||||||
private final Lazy<String> version;
|
private final Lazy<String> version;
|
||||||
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<DBSystem> dbSystem;
|
||||||
private final Lazy<ServerProperties> serverProperties;
|
private final Lazy<ServerProperties> serverProperties;
|
||||||
private final Lazy<Formatters> formatters;
|
private final Lazy<Formatters> formatters;
|
||||||
private final Lazy<Graphs> graphs;
|
private final Lazy<Graphs> graphs;
|
||||||
@ -223,7 +223,7 @@ public class NetworkContainer extends DataContainer {
|
|||||||
@Named("currentVersion") Lazy<String> version,
|
@Named("currentVersion") Lazy<String> version,
|
||||||
Lazy<PlanConfig> config,
|
Lazy<PlanConfig> config,
|
||||||
Lazy<Theme> theme,
|
Lazy<Theme> theme,
|
||||||
Lazy<Database> database,
|
Lazy<DBSystem> dbSystem,
|
||||||
Lazy<ServerProperties> serverProperties,
|
Lazy<ServerProperties> serverProperties,
|
||||||
Lazy<Formatters> formatters,
|
Lazy<Formatters> formatters,
|
||||||
Lazy<Graphs> graphs
|
Lazy<Graphs> graphs
|
||||||
@ -231,7 +231,7 @@ public class NetworkContainer extends DataContainer {
|
|||||||
this.version = version;
|
this.version = version;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.theme = theme;
|
this.theme = theme;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.serverProperties = serverProperties;
|
this.serverProperties = serverProperties;
|
||||||
this.formatters = formatters;
|
this.formatters = formatters;
|
||||||
this.graphs = graphs;
|
this.graphs = graphs;
|
||||||
@ -243,7 +243,7 @@ public class NetworkContainer extends DataContainer {
|
|||||||
version.get(),
|
version.get(),
|
||||||
config.get(),
|
config.get(),
|
||||||
theme.get(),
|
theme.get(),
|
||||||
database.get(),
|
dbSystem.get(),
|
||||||
serverProperties.get(),
|
serverProperties.get(),
|
||||||
formatters.get(),
|
formatters.get(),
|
||||||
graphs.get()
|
graphs.get()
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package com.djrapitops.plan.modules;
|
package com.djrapitops.plan.modules;
|
||||||
|
|
||||||
import com.djrapitops.plan.data.plugin.PluginsConfigSection;
|
import com.djrapitops.plan.data.plugin.PluginsConfigSection;
|
||||||
import com.djrapitops.plan.system.database.DBSystem;
|
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
|
||||||
import com.djrapitops.plan.system.locale.Locale;
|
import com.djrapitops.plan.system.locale.Locale;
|
||||||
import com.djrapitops.plan.system.locale.LocaleSystem;
|
import com.djrapitops.plan.system.locale.LocaleSystem;
|
||||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||||
@ -25,12 +23,6 @@ public class SystemObjectBindingModule {
|
|||||||
return localeSystem.getLocale();
|
return localeSystem.getLocale();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
|
||||||
@Singleton
|
|
||||||
Database provideDatabase(DBSystem dbSystem) {
|
|
||||||
return dbSystem.getActiveDatabase();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
PluginsConfigSection providePluginsConfigSection(PlanConfig config) {
|
PluginsConfigSection providePluginsConfigSection(PlanConfig config) {
|
||||||
|
@ -2,7 +2,7 @@ package com.djrapitops.plan.system.cache;
|
|||||||
|
|
||||||
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
||||||
import com.djrapitops.plan.system.SubSystem;
|
import com.djrapitops.plan.system.SubSystem;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
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;
|
||||||
|
|
||||||
@ -20,7 +20,6 @@ import java.util.UUID;
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>PlayerName cache, used for reducing database calls on chat events</li>
|
* <li>PlayerName cache, used for reducing database calls on chat events</li>
|
||||||
* <li>DisplayName cache, used for reducing database calls on chat events</li>
|
* <li>DisplayName cache, used for reducing database calls on chat events</li>
|
||||||
* <li>FirstSession MessageCount Map, used for tracking first session and message count on that session.</li>
|
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* @author Rsl1122
|
* @author Rsl1122
|
||||||
@ -30,7 +29,6 @@ import java.util.UUID;
|
|||||||
public class DataCache extends SessionCache implements SubSystem {
|
public class DataCache extends SessionCache implements SubSystem {
|
||||||
|
|
||||||
private final ErrorHandler errorHandler;
|
private final ErrorHandler errorHandler;
|
||||||
private Database database;
|
|
||||||
|
|
||||||
private final Map<UUID, String> playerNames;
|
private final Map<UUID, String> playerNames;
|
||||||
private final Map<String, UUID> uuids;
|
private final Map<String, UUID> uuids;
|
||||||
@ -38,16 +36,14 @@ public class DataCache extends SessionCache implements SubSystem {
|
|||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public DataCache(
|
public DataCache(
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
ErrorHandler errorHandler
|
ErrorHandler errorHandler
|
||||||
) {
|
) {
|
||||||
super(database);
|
super(dbSystem);
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
playerNames = new HashMap<>();
|
playerNames = new HashMap<>();
|
||||||
displayNames = new HashMap<>();
|
displayNames = new HashMap<>();
|
||||||
uuids = new HashMap<>();
|
uuids = new HashMap<>();
|
||||||
|
|
||||||
this.database = database;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -93,7 +89,7 @@ public class DataCache extends SessionCache implements SubSystem {
|
|||||||
String name = playerNames.get(uuid);
|
String name = playerNames.get(uuid);
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
try {
|
try {
|
||||||
name = database.fetch().getPlayerName(uuid);
|
name = dbSystem.getDatabase().fetch().getPlayerName(uuid);
|
||||||
playerNames.put(uuid, name);
|
playerNames.put(uuid, name);
|
||||||
} catch (DBOpException e) {
|
} catch (DBOpException e) {
|
||||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||||
@ -116,7 +112,7 @@ public class DataCache extends SessionCache implements SubSystem {
|
|||||||
if (cached == null) {
|
if (cached == null) {
|
||||||
List<String> nicknames;
|
List<String> nicknames;
|
||||||
try {
|
try {
|
||||||
nicknames = database.fetch().getNicknames(uuid);
|
nicknames = dbSystem.getDatabase().fetch().getNicknames(uuid);
|
||||||
if (!nicknames.isEmpty()) {
|
if (!nicknames.isEmpty()) {
|
||||||
return nicknames.get(nicknames.size() - 1);
|
return nicknames.get(nicknames.size() - 1);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.djrapitops.plan.system.cache;
|
package com.djrapitops.plan.system.cache;
|
||||||
|
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@ -18,8 +18,8 @@ import java.util.UUID;
|
|||||||
public class ProxyDataCache extends DataCache {
|
public class ProxyDataCache extends DataCache {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ProxyDataCache(Database database, ErrorHandler errorHandler) {
|
public ProxyDataCache(DBSystem dbSystem, ErrorHandler errorHandler) {
|
||||||
super(database, errorHandler);
|
super(dbSystem, errorHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,7 +2,7 @@ package com.djrapitops.plan.system.cache;
|
|||||||
|
|
||||||
import com.djrapitops.plan.data.container.Session;
|
import com.djrapitops.plan.data.container.Session;
|
||||||
import com.djrapitops.plan.data.store.keys.SessionKeys;
|
import com.djrapitops.plan.data.store.keys.SessionKeys;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -19,10 +19,10 @@ public class SessionCache {
|
|||||||
|
|
||||||
private static final Map<UUID, Session> activeSessions = new HashMap<>();
|
private static final Map<UUID, Session> activeSessions = new HashMap<>();
|
||||||
|
|
||||||
private final Database database;
|
protected final DBSystem dbSystem;
|
||||||
|
|
||||||
public SessionCache(Database database) {
|
public SessionCache(DBSystem dbSystem) {
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<UUID, Session> getActiveSessions() {
|
public static Map<UUID, Session> getActiveSessions() {
|
||||||
@ -74,7 +74,7 @@ public class SessionCache {
|
|||||||
try {
|
try {
|
||||||
session.endSession(time);
|
session.endSession(time);
|
||||||
// Might throw a DBOpException
|
// Might throw a DBOpException
|
||||||
database.save().session(uuid, session);
|
dbSystem.getDatabase().save().session(uuid, session);
|
||||||
} finally {
|
} finally {
|
||||||
removeSessionFromCache(uuid);
|
removeSessionFromCache(uuid);
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.djrapitops.plan.system.database;
|
package com.djrapitops.plan.system.database;
|
||||||
|
|
||||||
|
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||||
import com.djrapitops.plan.system.database.databases.sql.MySQLDB;
|
import com.djrapitops.plan.system.database.databases.sql.MySQLDB;
|
||||||
import com.djrapitops.plan.system.database.databases.sql.SQLiteDB;
|
import com.djrapitops.plan.system.database.databases.sql.SQLiteDB;
|
||||||
import com.djrapitops.plan.system.locale.Locale;
|
import com.djrapitops.plan.system.locale.Locale;
|
||||||
@ -24,15 +25,29 @@ import javax.inject.Singleton;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class BukkitDBSystem extends DBSystem {
|
public class BukkitDBSystem extends DBSystem {
|
||||||
|
|
||||||
|
private final PlanConfig config;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public BukkitDBSystem(Locale locale, MySQLDB mySQLDB, SQLiteDB.Factory sqLiteDB, PlanConfig config,
|
public BukkitDBSystem(
|
||||||
PluginLogger logger, Timings timings, ErrorHandler errorHandler) {
|
Locale locale,
|
||||||
|
MySQLDB mySQLDB,
|
||||||
|
SQLiteDB.Factory sqLiteDB,
|
||||||
|
PlanConfig config,
|
||||||
|
PluginLogger logger,
|
||||||
|
Timings timings,
|
||||||
|
ErrorHandler errorHandler
|
||||||
|
) {
|
||||||
super(locale, logger, timings, errorHandler);
|
super(locale, logger, timings, errorHandler);
|
||||||
|
this.config = config;
|
||||||
|
|
||||||
databases.add(mySQLDB);
|
databases.add(mySQLDB);
|
||||||
databases.add(sqLiteDB.usingDefaultFile());
|
databases.add(sqLiteDB.usingDefaultFile());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enable() throws EnableException {
|
||||||
String dbType = config.getString(Settings.DB_TYPE).toLowerCase().trim();
|
String dbType = config.getString(Settings.DB_TYPE).toLowerCase().trim();
|
||||||
db = getActiveDatabaseByName(dbType);
|
db = getActiveDatabaseByName(dbType);
|
||||||
|
super.enable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ public abstract class DBSystem implements SubSystem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Database getActiveDatabase() {
|
public Database getDatabase() {
|
||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,8 +22,13 @@ import javax.inject.Singleton;
|
|||||||
public class ProxyDBSystem extends DBSystem {
|
public class ProxyDBSystem extends DBSystem {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ProxyDBSystem(Locale locale, MySQLDB mySQLDB,
|
public ProxyDBSystem(
|
||||||
PluginLogger logger, Timings timings, ErrorHandler errorHandler) {
|
Locale locale,
|
||||||
|
MySQLDB mySQLDB,
|
||||||
|
PluginLogger logger,
|
||||||
|
Timings timings,
|
||||||
|
ErrorHandler errorHandler
|
||||||
|
) {
|
||||||
super(locale, logger, timings, errorHandler);
|
super(locale, logger, timings, errorHandler);
|
||||||
databases.add(mySQLDB);
|
databases.add(mySQLDB);
|
||||||
db = mySQLDB;
|
db = mySQLDB;
|
||||||
|
@ -13,7 +13,8 @@ import com.djrapitops.plan.data.container.UserInfo;
|
|||||||
import com.djrapitops.plan.data.store.objects.Nickname;
|
import com.djrapitops.plan.data.store.objects.Nickname;
|
||||||
import com.djrapitops.plan.data.time.WorldTimes;
|
import com.djrapitops.plan.data.time.WorldTimes;
|
||||||
import com.djrapitops.plan.system.cache.GeolocationCache;
|
import com.djrapitops.plan.system.cache.GeolocationCache;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
|
import com.djrapitops.plan.system.database.databases.operation.FetchOperations;
|
||||||
import com.djrapitops.plan.system.database.databases.operation.SaveOperations;
|
import com.djrapitops.plan.system.database.databases.operation.SaveOperations;
|
||||||
import com.djrapitops.plan.system.importing.data.ServerImportData;
|
import com.djrapitops.plan.system.importing.data.ServerImportData;
|
||||||
import com.djrapitops.plan.system.importing.data.UserImportData;
|
import com.djrapitops.plan.system.importing.data.UserImportData;
|
||||||
@ -38,7 +39,7 @@ import java.util.stream.Collectors;
|
|||||||
public abstract class Importer {
|
public abstract class Importer {
|
||||||
|
|
||||||
private final GeolocationCache geolocationCache;
|
private final GeolocationCache geolocationCache;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
protected final Supplier<UUID> serverUUID;
|
protected final Supplier<UUID> serverUUID;
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
@ -47,12 +48,12 @@ public abstract class Importer {
|
|||||||
protected Importer(
|
protected Importer(
|
||||||
Plan plugin,
|
Plan plugin,
|
||||||
GeolocationCache geolocationCache,
|
GeolocationCache geolocationCache,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
ServerInfo serverInfo,
|
ServerInfo serverInfo,
|
||||||
String name
|
String name
|
||||||
) {
|
) {
|
||||||
this.geolocationCache = geolocationCache;
|
this.geolocationCache = geolocationCache;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.serverUUID = serverInfo::getServerUUID;
|
this.serverUUID = serverInfo::getServerUUID;
|
||||||
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@ -97,7 +98,7 @@ public abstract class Importer {
|
|||||||
|
|
||||||
ExecutorService service = Executors.newCachedThreadPool();
|
ExecutorService service = Executors.newCachedThreadPool();
|
||||||
|
|
||||||
SaveOperations save = database.save();
|
SaveOperations save = dbSystem.getDatabase().save();
|
||||||
submitTo(service, () -> save.insertTPS(ImmutableMap.of(serverUUID.get(), serverImportData.getTpsData())));
|
submitTo(service, () -> save.insertTPS(ImmutableMap.of(serverUUID.get(), serverImportData.getTpsData())));
|
||||||
submitTo(service, () -> save.insertCommandUsage(ImmutableMap.of(serverUUID.get(), serverImportData.getCommandUsages())));
|
submitTo(service, () -> save.insertCommandUsage(ImmutableMap.of(serverUUID.get(), serverImportData.getCommandUsages())));
|
||||||
|
|
||||||
@ -120,8 +121,9 @@ public abstract class Importer {
|
|||||||
UserImportRefiner userImportRefiner = new UserImportRefiner(plugin, userImportData);
|
UserImportRefiner userImportRefiner = new UserImportRefiner(plugin, userImportData);
|
||||||
userImportData = userImportRefiner.refineData();
|
userImportData = userImportRefiner.refineData();
|
||||||
|
|
||||||
Set<UUID> existingUUIDs = database.fetch().getSavedUUIDs();
|
FetchOperations fetch = dbSystem.getDatabase().fetch();
|
||||||
Set<UUID> existingUserInfoTableUUIDs = database.fetch().getSavedUUIDs(serverUUID.get());
|
Set<UUID> existingUUIDs = fetch.getSavedUUIDs();
|
||||||
|
Set<UUID> existingUserInfoTableUUIDs = fetch.getSavedUUIDs(serverUUID.get());
|
||||||
|
|
||||||
Map<UUID, UserInfo> users = new HashMap<>();
|
Map<UUID, UserInfo> users = new HashMap<>();
|
||||||
List<UserInfo> userInfo = new ArrayList<>();
|
List<UserInfo> userInfo = new ArrayList<>();
|
||||||
@ -150,7 +152,7 @@ public abstract class Importer {
|
|||||||
|
|
||||||
ExecutorService service = Executors.newCachedThreadPool();
|
ExecutorService service = Executors.newCachedThreadPool();
|
||||||
|
|
||||||
SaveOperations save = database.save();
|
SaveOperations save = dbSystem.getDatabase().save();
|
||||||
|
|
||||||
save.insertUsers(users);
|
save.insertUsers(users);
|
||||||
submitTo(service, () -> save.insertSessions(ImmutableMap.of(serverUUID.get(), sessions), true));
|
submitTo(service, () -> save.insertSessions(ImmutableMap.of(serverUUID.get(), sessions), true));
|
||||||
|
@ -6,7 +6,7 @@ package com.djrapitops.plan.system.importing.importers;
|
|||||||
|
|
||||||
import com.djrapitops.plan.Plan;
|
import com.djrapitops.plan.Plan;
|
||||||
import com.djrapitops.plan.system.cache.GeolocationCache;
|
import com.djrapitops.plan.system.cache.GeolocationCache;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
import com.djrapitops.plan.system.importing.data.ServerImportData;
|
import com.djrapitops.plan.system.importing.data.ServerImportData;
|
||||||
import com.djrapitops.plan.system.importing.data.UserImportData;
|
import com.djrapitops.plan.system.importing.data.UserImportData;
|
||||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||||
@ -31,10 +31,10 @@ public class OfflinePlayerImporter extends Importer {
|
|||||||
public OfflinePlayerImporter(
|
public OfflinePlayerImporter(
|
||||||
Plan plugin,
|
Plan plugin,
|
||||||
GeolocationCache geolocationCache,
|
GeolocationCache geolocationCache,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
ServerInfo serverInfo
|
ServerInfo serverInfo
|
||||||
) {
|
) {
|
||||||
super(plugin, geolocationCache, database, serverInfo, "offline");
|
super(plugin, geolocationCache, dbSystem, serverInfo, "offline");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -6,7 +6,7 @@ package com.djrapitops.plan.system.info.connection;
|
|||||||
|
|
||||||
import com.djrapitops.plan.api.exceptions.connection.NotFoundException;
|
import com.djrapitops.plan.api.exceptions.connection.NotFoundException;
|
||||||
import com.djrapitops.plan.api.exceptions.connection.WebException;
|
import com.djrapitops.plan.api.exceptions.connection.WebException;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
import com.djrapitops.plan.system.info.request.InfoRequest;
|
import com.djrapitops.plan.system.info.request.InfoRequest;
|
||||||
import com.djrapitops.plan.system.webserver.Request;
|
import com.djrapitops.plan.system.webserver.Request;
|
||||||
import com.djrapitops.plan.system.webserver.pages.PageHandler;
|
import com.djrapitops.plan.system.webserver.pages.PageHandler;
|
||||||
@ -32,18 +32,18 @@ import java.util.List;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class InfoRequestPageHandler implements PageHandler {
|
public class InfoRequestPageHandler implements PageHandler {
|
||||||
|
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final ConnectionSystem connectionSystem;
|
private final ConnectionSystem connectionSystem;
|
||||||
private final ResponseFactory responseFactory;
|
private final ResponseFactory responseFactory;
|
||||||
private final PluginLogger logger;
|
private final PluginLogger logger;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public InfoRequestPageHandler(
|
public InfoRequestPageHandler(
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
ConnectionSystem connectionSystem,
|
ConnectionSystem connectionSystem,
|
||||||
ResponseFactory responseFactory, PluginLogger logger
|
ResponseFactory responseFactory, PluginLogger logger
|
||||||
) {
|
) {
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.connectionSystem = connectionSystem;
|
this.connectionSystem = connectionSystem;
|
||||||
this.responseFactory = responseFactory;
|
this.responseFactory = responseFactory;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
@ -68,7 +68,7 @@ public class InfoRequestPageHandler implements PageHandler {
|
|||||||
Verify.nullCheck(infoRequest, () -> new NotFoundException("Info Request has not been registered."));
|
Verify.nullCheck(infoRequest, () -> new NotFoundException("Info Request has not been registered."));
|
||||||
|
|
||||||
logger.debug("ConnectionIn: " + infoRequest.getClass().getSimpleName());
|
logger.debug("ConnectionIn: " + infoRequest.getClass().getSimpleName());
|
||||||
return new ConnectionIn(request, infoRequest, database, connectionSystem).handleRequest();
|
return new ConnectionIn(request, infoRequest, dbSystem.getDatabase(), connectionSystem).handleRequest();
|
||||||
} catch (WebException e) {
|
} catch (WebException e) {
|
||||||
responseCode = getResponseCodeFor(e);
|
responseCode = getResponseCodeFor(e);
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -6,7 +6,7 @@ package com.djrapitops.plan.system.info.connection;
|
|||||||
|
|
||||||
import com.djrapitops.plan.api.exceptions.connection.NoServersException;
|
import com.djrapitops.plan.api.exceptions.connection.NoServersException;
|
||||||
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
import com.djrapitops.plan.system.info.InfoSystem;
|
import com.djrapitops.plan.system.info.InfoSystem;
|
||||||
import com.djrapitops.plan.system.info.request.*;
|
import com.djrapitops.plan.system.info.request.*;
|
||||||
import com.djrapitops.plan.system.info.server.Server;
|
import com.djrapitops.plan.system.info.server.Server;
|
||||||
@ -29,7 +29,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class ProxyConnectionSystem extends ConnectionSystem {
|
public class ProxyConnectionSystem extends ConnectionSystem {
|
||||||
|
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final Lazy<WebServer> webServer;
|
private final Lazy<WebServer> webServer;
|
||||||
private final ErrorHandler errorHandler;
|
private final ErrorHandler errorHandler;
|
||||||
private final WebExceptionLogger webExceptionLogger;
|
private final WebExceptionLogger webExceptionLogger;
|
||||||
@ -38,7 +38,7 @@ public class ProxyConnectionSystem extends ConnectionSystem {
|
|||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ProxyConnectionSystem(
|
public ProxyConnectionSystem(
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
Lazy<WebServer> webServer,
|
Lazy<WebServer> webServer,
|
||||||
ConnectionLog connectionLog,
|
ConnectionLog connectionLog,
|
||||||
InfoRequests infoRequests,
|
InfoRequests infoRequests,
|
||||||
@ -48,7 +48,7 @@ public class ProxyConnectionSystem extends ConnectionSystem {
|
|||||||
WebExceptionLogger webExceptionLogger
|
WebExceptionLogger webExceptionLogger
|
||||||
) {
|
) {
|
||||||
super(connectionLog, infoRequests, infoSystem, serverInfo);
|
super(connectionLog, infoRequests, infoSystem, serverInfo);
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.webServer = webServer;
|
this.webServer = webServer;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
this.webExceptionLogger = webExceptionLogger;
|
this.webExceptionLogger = webExceptionLogger;
|
||||||
@ -58,7 +58,7 @@ public class ProxyConnectionSystem extends ConnectionSystem {
|
|||||||
private void refreshServerMap() {
|
private void refreshServerMap() {
|
||||||
if (latestServerMapRefresh < System.currentTimeMillis() - TimeUnit.SECONDS.toMillis(15L)) {
|
if (latestServerMapRefresh < System.currentTimeMillis() - TimeUnit.SECONDS.toMillis(15L)) {
|
||||||
try {
|
try {
|
||||||
bukkitServers = database.fetch().getBukkitServers();
|
bukkitServers = dbSystem.getDatabase().fetch().getBukkitServers();
|
||||||
latestServerMapRefresh = System.currentTimeMillis();
|
latestServerMapRefresh = System.currentTimeMillis();
|
||||||
} catch (DBOpException e) {
|
} catch (DBOpException e) {
|
||||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||||
|
@ -6,7 +6,8 @@ package com.djrapitops.plan.system.info.connection;
|
|||||||
|
|
||||||
import com.djrapitops.plan.api.exceptions.connection.ConnectionFailException;
|
import com.djrapitops.plan.api.exceptions.connection.ConnectionFailException;
|
||||||
import com.djrapitops.plan.api.exceptions.connection.NoServersException;
|
import com.djrapitops.plan.api.exceptions.connection.NoServersException;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
|
import com.djrapitops.plan.system.database.databases.operation.FetchOperations;
|
||||||
import com.djrapitops.plan.system.info.InfoSystem;
|
import com.djrapitops.plan.system.info.InfoSystem;
|
||||||
import com.djrapitops.plan.system.info.request.*;
|
import com.djrapitops.plan.system.info.request.*;
|
||||||
import com.djrapitops.plan.system.info.server.Server;
|
import com.djrapitops.plan.system.info.server.Server;
|
||||||
@ -23,7 +24,6 @@ import dagger.Lazy;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ public class ServerConnectionSystem extends ConnectionSystem {
|
|||||||
private final Locale locale;
|
private final Locale locale;
|
||||||
private final PlanConfig config;
|
private final PlanConfig config;
|
||||||
private final Processing processing;
|
private final Processing processing;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final Lazy<WebServer> webServer;
|
private final Lazy<WebServer> webServer;
|
||||||
private final PluginLogger pluginLogger;
|
private final PluginLogger pluginLogger;
|
||||||
private final WebExceptionLogger webExceptionLogger;
|
private final WebExceptionLogger webExceptionLogger;
|
||||||
@ -52,7 +52,7 @@ public class ServerConnectionSystem extends ConnectionSystem {
|
|||||||
Locale locale,
|
Locale locale,
|
||||||
PlanConfig config,
|
PlanConfig config,
|
||||||
Processing processing,
|
Processing processing,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
Lazy<WebServer> webServer,
|
Lazy<WebServer> webServer,
|
||||||
ConnectionLog connectionLog,
|
ConnectionLog connectionLog,
|
||||||
InfoRequests infoRequests,
|
InfoRequests infoRequests,
|
||||||
@ -65,7 +65,7 @@ public class ServerConnectionSystem extends ConnectionSystem {
|
|||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.processing = processing;
|
this.processing = processing;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.webServer = webServer;
|
this.webServer = webServer;
|
||||||
this.pluginLogger = pluginLogger;
|
this.pluginLogger = pluginLogger;
|
||||||
this.webExceptionLogger = webExceptionLogger;
|
this.webExceptionLogger = webExceptionLogger;
|
||||||
@ -75,9 +75,9 @@ public class ServerConnectionSystem extends ConnectionSystem {
|
|||||||
private void refreshServerMap() {
|
private void refreshServerMap() {
|
||||||
processing.submitNonCritical(() -> {
|
processing.submitNonCritical(() -> {
|
||||||
if (latestServerMapRefresh < System.currentTimeMillis() - TimeUnit.SECONDS.toMillis(15L)) {
|
if (latestServerMapRefresh < System.currentTimeMillis() - TimeUnit.SECONDS.toMillis(15L)) {
|
||||||
Optional<Server> bungeeInformation = database.fetch().getBungeeInformation();
|
FetchOperations fetch = dbSystem.getDatabase().fetch();
|
||||||
bungeeInformation.ifPresent(server -> mainServer = server);
|
mainServer = fetch.getBungeeInformation().orElse(null);
|
||||||
bukkitServers = database.fetch().getBukkitServers();
|
bukkitServers = fetch.getBukkitServers();
|
||||||
latestServerMapRefresh = System.currentTimeMillis();
|
latestServerMapRefresh = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -6,6 +6,7 @@ package com.djrapitops.plan.system.info.server;
|
|||||||
|
|
||||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||||
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
||||||
|
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.info.server.properties.ServerProperties;
|
import com.djrapitops.plan.system.info.server.properties.ServerProperties;
|
||||||
import com.djrapitops.plan.system.settings.Settings;
|
import com.djrapitops.plan.system.settings.Settings;
|
||||||
@ -32,19 +33,19 @@ public class BukkitServerInfo extends ServerInfo {
|
|||||||
private final Lazy<WebServer> webServer;
|
private final Lazy<WebServer> webServer;
|
||||||
private final PlanConfig config;
|
private final PlanConfig config;
|
||||||
private ServerInfoFile serverInfoFile;
|
private ServerInfoFile serverInfoFile;
|
||||||
private Database database;
|
private DBSystem dbSystem;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public BukkitServerInfo(
|
public BukkitServerInfo(
|
||||||
ServerProperties serverProperties,
|
ServerProperties serverProperties,
|
||||||
ServerInfoFile serverInfoFile,
|
ServerInfoFile serverInfoFile,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
Lazy<WebServer> webServer,
|
Lazy<WebServer> webServer,
|
||||||
PlanConfig config
|
PlanConfig config
|
||||||
) {
|
) {
|
||||||
super(serverProperties);
|
super(serverProperties);
|
||||||
this.serverInfoFile = serverInfoFile;
|
this.serverInfoFile = serverInfoFile;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.webServer = webServer;
|
this.webServer = webServer;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
}
|
}
|
||||||
@ -73,6 +74,7 @@ public class BukkitServerInfo extends ServerInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Server updateDbInfo(UUID serverUUID) throws IOException {
|
private Server updateDbInfo(UUID serverUUID) throws IOException {
|
||||||
|
Database database = dbSystem.getDatabase();
|
||||||
Optional<Integer> serverID = database.fetch().getServerID(serverUUID);
|
Optional<Integer> serverID = database.fetch().getServerID(serverUUID);
|
||||||
if (!serverID.isPresent()) {
|
if (!serverID.isPresent()) {
|
||||||
return registerServer(serverUUID);
|
return registerServer(serverUUID);
|
||||||
@ -99,14 +101,12 @@ public class BukkitServerInfo extends ServerInfo {
|
|||||||
int maxPlayers = serverProperties.getMaxPlayers();
|
int maxPlayers = serverProperties.getMaxPlayers();
|
||||||
|
|
||||||
Server server = new Server(-1, serverUUID, name, webAddress, maxPlayers);
|
Server server = new Server(-1, serverUUID, name, webAddress, maxPlayers);
|
||||||
|
|
||||||
|
Database database = dbSystem.getDatabase();
|
||||||
database.save().serverInfoForThisServer(server);
|
database.save().serverInfoForThisServer(server);
|
||||||
|
|
||||||
Optional<Integer> serverID = database.fetch().getServerID(serverUUID);
|
Optional<Integer> serverID = database.fetch().getServerID(serverUUID);
|
||||||
if (!serverID.isPresent()) {
|
int id = serverID.orElseThrow(() -> new IllegalStateException("Failed to Register Server (ID not found)"));
|
||||||
throw new IllegalStateException("Failed to Register Server (ID not found)");
|
|
||||||
}
|
|
||||||
|
|
||||||
int id = serverID.get();
|
|
||||||
server.setId(id);
|
server.setId(id);
|
||||||
|
|
||||||
serverInfoFile.saveServerUUID(serverUUID);
|
serverInfoFile.saveServerUUID(serverUUID);
|
||||||
|
@ -6,6 +6,7 @@ package com.djrapitops.plan.system.info.server;
|
|||||||
|
|
||||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||||
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
||||||
|
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.info.server.properties.ServerProperties;
|
import com.djrapitops.plan.system.info.server.properties.ServerProperties;
|
||||||
import com.djrapitops.plan.system.webserver.WebServer;
|
import com.djrapitops.plan.system.webserver.WebServer;
|
||||||
@ -25,19 +26,19 @@ import java.util.UUID;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class BungeeServerInfo extends ServerInfo {
|
public class BungeeServerInfo extends ServerInfo {
|
||||||
|
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final Lazy<WebServer> webServer;
|
private final Lazy<WebServer> webServer;
|
||||||
private final PluginLogger logger;
|
private final PluginLogger logger;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public BungeeServerInfo(
|
public BungeeServerInfo(
|
||||||
ServerProperties serverProperties,
|
ServerProperties serverProperties,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
Lazy<WebServer> webServer,
|
Lazy<WebServer> webServer,
|
||||||
PluginLogger logger
|
PluginLogger logger
|
||||||
) {
|
) {
|
||||||
super(serverProperties);
|
super(serverProperties);
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.webServer = webServer;
|
this.webServer = webServer;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
}
|
}
|
||||||
@ -47,6 +48,7 @@ public class BungeeServerInfo extends ServerInfo {
|
|||||||
checkIfDefaultIP();
|
checkIfDefaultIP();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Database database = dbSystem.getDatabase();
|
||||||
Optional<Server> bungeeInfo = database.fetch().getBungeeInformation();
|
Optional<Server> bungeeInfo = database.fetch().getBungeeInformation();
|
||||||
if (bungeeInfo.isPresent()) {
|
if (bungeeInfo.isPresent()) {
|
||||||
server = bungeeInfo.get();
|
server = bungeeInfo.get();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.djrapitops.plan.system.info.server;
|
package com.djrapitops.plan.system.info.server;
|
||||||
|
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
import com.djrapitops.plan.system.info.server.properties.ServerProperties;
|
import com.djrapitops.plan.system.info.server.properties.ServerProperties;
|
||||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||||
import com.djrapitops.plan.system.webserver.WebServer;
|
import com.djrapitops.plan.system.webserver.WebServer;
|
||||||
@ -14,10 +14,10 @@ public class SpongeServerInfo extends BukkitServerInfo {
|
|||||||
public SpongeServerInfo(
|
public SpongeServerInfo(
|
||||||
ServerProperties serverProperties,
|
ServerProperties serverProperties,
|
||||||
ServerInfoFile serverInfoFile,
|
ServerInfoFile serverInfoFile,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
Lazy<WebServer> webServer,
|
Lazy<WebServer> webServer,
|
||||||
PlanConfig config
|
PlanConfig config
|
||||||
) {
|
) {
|
||||||
super(serverProperties, serverInfoFile, database, webServer, config);
|
super(serverProperties, serverInfoFile, dbSystem, webServer, config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ package com.djrapitops.plan.system.info.server;
|
|||||||
|
|
||||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||||
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
||||||
|
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.info.server.properties.ServerProperties;
|
import com.djrapitops.plan.system.info.server.properties.ServerProperties;
|
||||||
import com.djrapitops.plan.system.webserver.WebServer;
|
import com.djrapitops.plan.system.webserver.WebServer;
|
||||||
@ -25,19 +26,19 @@ import java.util.UUID;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class VelocityServerInfo extends ServerInfo {
|
public class VelocityServerInfo extends ServerInfo {
|
||||||
|
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final Lazy<WebServer> webServer;
|
private final Lazy<WebServer> webServer;
|
||||||
private final PluginLogger logger;
|
private final PluginLogger logger;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public VelocityServerInfo(
|
public VelocityServerInfo(
|
||||||
ServerProperties serverProperties,
|
ServerProperties serverProperties,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
Lazy<WebServer> webServer,
|
Lazy<WebServer> webServer,
|
||||||
PluginLogger logger
|
PluginLogger logger
|
||||||
) {
|
) {
|
||||||
super(serverProperties);
|
super(serverProperties);
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.webServer = webServer;
|
this.webServer = webServer;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
}
|
}
|
||||||
@ -47,6 +48,7 @@ public class VelocityServerInfo extends ServerInfo {
|
|||||||
checkIfDefaultIP();
|
checkIfDefaultIP();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Database database = dbSystem.getDatabase();
|
||||||
Optional<Server> bungeeInfo = database.fetch().getBungeeInformation();
|
Optional<Server> bungeeInfo = database.fetch().getBungeeInformation();
|
||||||
if (bungeeInfo.isPresent()) {
|
if (bungeeInfo.isPresent()) {
|
||||||
server = bungeeInfo.get();
|
server = bungeeInfo.get();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.djrapitops.plan.system.processing.processors;
|
package com.djrapitops.plan.system.processing.processors;
|
||||||
|
|
||||||
import com.djrapitops.plan.data.container.TPS;
|
import com.djrapitops.plan.data.container.TPS;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
import com.djrapitops.plan.system.processing.processors.info.InfoProcessors;
|
import com.djrapitops.plan.system.processing.processors.info.InfoProcessors;
|
||||||
import com.djrapitops.plan.system.processing.processors.player.PlayerProcessors;
|
import com.djrapitops.plan.system.processing.processors.player.PlayerProcessors;
|
||||||
import dagger.Lazy;
|
import dagger.Lazy;
|
||||||
@ -21,26 +21,26 @@ public class Processors {
|
|||||||
private final PlayerProcessors playerProcessors;
|
private final PlayerProcessors playerProcessors;
|
||||||
private final InfoProcessors infoProcessors;
|
private final InfoProcessors infoProcessors;
|
||||||
|
|
||||||
private final Lazy<Database> database;
|
private final Lazy<DBSystem> dbSystem;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public Processors(
|
public Processors(
|
||||||
PlayerProcessors playerProcessors,
|
PlayerProcessors playerProcessors,
|
||||||
InfoProcessors infoProcessors,
|
InfoProcessors infoProcessors,
|
||||||
|
|
||||||
Lazy<Database> database
|
Lazy<DBSystem> dbSystem
|
||||||
) {
|
) {
|
||||||
this.playerProcessors = playerProcessors;
|
this.playerProcessors = playerProcessors;
|
||||||
this.infoProcessors = infoProcessors;
|
this.infoProcessors = infoProcessors;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TPSInsertProcessor tpsInsertProcessor(List<TPS> tpsList) {
|
public TPSInsertProcessor tpsInsertProcessor(List<TPS> tpsList) {
|
||||||
return new TPSInsertProcessor(tpsList, database.get());
|
return new TPSInsertProcessor(tpsList, dbSystem.get().getDatabase());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandProcessor commandProcessor(String command) {
|
public CommandProcessor commandProcessor(String command) {
|
||||||
return new CommandProcessor(command, database.get());
|
return new CommandProcessor(command, dbSystem.get().getDatabase());
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerProcessors player() {
|
public PlayerProcessors player() {
|
||||||
|
@ -4,7 +4,7 @@ import com.djrapitops.plan.data.store.objects.DateObj;
|
|||||||
import com.djrapitops.plan.data.store.objects.Nickname;
|
import com.djrapitops.plan.data.store.objects.Nickname;
|
||||||
import com.djrapitops.plan.system.cache.DataCache;
|
import com.djrapitops.plan.system.cache.DataCache;
|
||||||
import com.djrapitops.plan.system.cache.GeolocationCache;
|
import com.djrapitops.plan.system.cache.GeolocationCache;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
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;
|
||||||
import dagger.Lazy;
|
import dagger.Lazy;
|
||||||
@ -26,7 +26,7 @@ public class PlayerProcessors {
|
|||||||
|
|
||||||
private final Lazy<Processing> processing;
|
private final Lazy<Processing> processing;
|
||||||
private final Lazy<ServerInfo> serverInfo;
|
private final Lazy<ServerInfo> serverInfo;
|
||||||
private final Lazy<Database> database;
|
private final Lazy<DBSystem> dbSystem;
|
||||||
private final Lazy<DataCache> dataCache;
|
private final Lazy<DataCache> dataCache;
|
||||||
private final Lazy<GeolocationCache> geolocationCache;
|
private final Lazy<GeolocationCache> geolocationCache;
|
||||||
|
|
||||||
@ -34,23 +34,23 @@ public class PlayerProcessors {
|
|||||||
public PlayerProcessors(
|
public PlayerProcessors(
|
||||||
Lazy<Processing> processing,
|
Lazy<Processing> processing,
|
||||||
Lazy<ServerInfo> serverInfo,
|
Lazy<ServerInfo> serverInfo,
|
||||||
Lazy<Database> database,
|
Lazy<DBSystem> dbSystem,
|
||||||
Lazy<DataCache> dataCache,
|
Lazy<DataCache> dataCache,
|
||||||
Lazy<GeolocationCache> geolocationCache
|
Lazy<GeolocationCache> geolocationCache
|
||||||
) {
|
) {
|
||||||
this.processing = processing;
|
this.processing = processing;
|
||||||
this.serverInfo = serverInfo;
|
this.serverInfo = serverInfo;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.dataCache = dataCache;
|
this.dataCache = dataCache;
|
||||||
this.geolocationCache = geolocationCache;
|
this.geolocationCache = geolocationCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BanAndOpProcessor banAndOpProcessor(UUID uuid, Supplier<Boolean> banned, boolean op) {
|
public BanAndOpProcessor banAndOpProcessor(UUID uuid, Supplier<Boolean> banned, boolean op) {
|
||||||
return new BanAndOpProcessor(uuid, banned, op, database.get());
|
return new BanAndOpProcessor(uuid, banned, op, dbSystem.get().getDatabase());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProxyRegisterProcessor proxyRegisterProcessor(UUID uuid, String name, long registered, Runnable... afterProcess) {
|
public ProxyRegisterProcessor proxyRegisterProcessor(UUID uuid, String name, long registered, Runnable... afterProcess) {
|
||||||
return new ProxyRegisterProcessor(uuid, name, registered, processing.get(), database.get(), afterProcess);
|
return new ProxyRegisterProcessor(uuid, name, registered, processing.get(), dbSystem.get().getDatabase(), afterProcess);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EndSessionProcessor endSessionProcessor(UUID uuid, long time) {
|
public EndSessionProcessor endSessionProcessor(UUID uuid, long time) {
|
||||||
@ -58,24 +58,24 @@ public class PlayerProcessors {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IPUpdateProcessor ipUpdateProcessor(UUID uuid, InetAddress ip, long time) {
|
public IPUpdateProcessor ipUpdateProcessor(UUID uuid, InetAddress ip, long time) {
|
||||||
return new IPUpdateProcessor(uuid, ip, time, database.get(), geolocationCache.get());
|
return new IPUpdateProcessor(uuid, ip, time, dbSystem.get().getDatabase(), geolocationCache.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
public KickProcessor kickProcessor(UUID uuid) {
|
public KickProcessor kickProcessor(UUID uuid) {
|
||||||
return new KickProcessor(uuid, database.get());
|
return new KickProcessor(uuid, dbSystem.get().getDatabase());
|
||||||
}
|
}
|
||||||
|
|
||||||
public NameProcessor nameProcessor(UUID uuid, String playerName, String displayName) {
|
public NameProcessor nameProcessor(UUID uuid, String playerName, String displayName) {
|
||||||
Nickname nickname = new Nickname(displayName, System.currentTimeMillis(), serverInfo.get().getServerUUID());
|
Nickname nickname = new Nickname(displayName, System.currentTimeMillis(), serverInfo.get().getServerUUID());
|
||||||
return new NameProcessor(uuid, playerName, nickname, database.get(), dataCache.get());
|
return new NameProcessor(uuid, playerName, nickname, dbSystem.get().getDatabase(), dataCache.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
public PingInsertProcessor pingInsertProcessor(UUID uuid, List<DateObj<Integer>> pingList) {
|
public PingInsertProcessor pingInsertProcessor(UUID uuid, List<DateObj<Integer>> pingList) {
|
||||||
return new PingInsertProcessor(uuid, serverInfo.get().getServerUUID(), pingList, database.get());
|
return new PingInsertProcessor(uuid, serverInfo.get().getServerUUID(), pingList, dbSystem.get().getDatabase());
|
||||||
}
|
}
|
||||||
|
|
||||||
public RegisterProcessor registerProcessor(UUID uuid, Supplier<Long> registered, String name, Runnable... afterProcess) {
|
public RegisterProcessor registerProcessor(UUID uuid, Supplier<Long> registered, String name, Runnable... afterProcess) {
|
||||||
return new RegisterProcessor(uuid, registered, name, processing.get(), database.get(), afterProcess);
|
return new RegisterProcessor(uuid, registered, name, processing.get(), dbSystem.get().getDatabase(), afterProcess);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.djrapitops.plan.system.settings.network;
|
package com.djrapitops.plan.system.settings.network;
|
||||||
|
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
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;
|
||||||
import com.djrapitops.plan.system.settings.ServerSpecificSettings;
|
import com.djrapitops.plan.system.settings.ServerSpecificSettings;
|
||||||
@ -42,7 +42,7 @@ public class NetworkSettings {
|
|||||||
private final Lazy<PlanConfig> config;
|
private final Lazy<PlanConfig> config;
|
||||||
private final ServerSpecificSettings serverSpecificSettings;
|
private final ServerSpecificSettings serverSpecificSettings;
|
||||||
private final Processing processing;
|
private final Processing processing;
|
||||||
private final Lazy<Database> database;
|
private final Lazy<DBSystem> dbSystem;
|
||||||
private final Lazy<ServerInfo> serverInfo;
|
private final Lazy<ServerInfo> serverInfo;
|
||||||
private final PluginLogger logger;
|
private final PluginLogger logger;
|
||||||
private final ErrorHandler errorHandler;
|
private final ErrorHandler errorHandler;
|
||||||
@ -52,7 +52,7 @@ public class NetworkSettings {
|
|||||||
Lazy<PlanConfig> config,
|
Lazy<PlanConfig> config,
|
||||||
ServerSpecificSettings serverSpecificSettings,
|
ServerSpecificSettings serverSpecificSettings,
|
||||||
Processing processing,
|
Processing processing,
|
||||||
Lazy<Database> database,
|
Lazy<DBSystem> dbSystem,
|
||||||
Lazy<ServerInfo> serverInfo,
|
Lazy<ServerInfo> serverInfo,
|
||||||
PluginLogger logger,
|
PluginLogger logger,
|
||||||
ErrorHandler errorHandler
|
ErrorHandler errorHandler
|
||||||
@ -60,7 +60,7 @@ public class NetworkSettings {
|
|||||||
this.config = config;
|
this.config = config;
|
||||||
this.serverSpecificSettings = serverSpecificSettings;
|
this.serverSpecificSettings = serverSpecificSettings;
|
||||||
this.processing = processing;
|
this.processing = processing;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.serverInfo = serverInfo;
|
this.serverInfo = serverInfo;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
@ -90,7 +90,7 @@ public class NetworkSettings {
|
|||||||
|
|
||||||
void loadFromDatabase() {
|
void loadFromDatabase() {
|
||||||
logger.debug("NetworkSettings: Fetch Config settings from database..");
|
logger.debug("NetworkSettings: Fetch Config settings from database..");
|
||||||
Optional<String> encodedConfigSettings = database.get().transfer().getEncodedConfigSettings();
|
Optional<String> encodedConfigSettings = dbSystem.get().getDatabase().transfer().getEncodedConfigSettings();
|
||||||
|
|
||||||
if (!encodedConfigSettings.isPresent()) {
|
if (!encodedConfigSettings.isPresent()) {
|
||||||
logger.debug("NetworkSettings: No Config settings in database.");
|
logger.debug("NetworkSettings: No Config settings in database.");
|
||||||
@ -157,7 +157,7 @@ public class NetworkSettings {
|
|||||||
String base64 = Base64Util.encode(transferBuilder.toString());
|
String base64 = Base64Util.encode(transferBuilder.toString());
|
||||||
|
|
||||||
logger.debug("NetworkSettings: Saving Config settings to database..");
|
logger.debug("NetworkSettings: Saving Config settings to database..");
|
||||||
database.get().transfer().storeConfigSettings(base64);
|
dbSystem.get().getDatabase().transfer().storeConfigSettings(base64);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> getConfigValues() {
|
private Map<String, Object> getConfigValues() {
|
||||||
@ -230,7 +230,7 @@ public class NetworkSettings {
|
|||||||
private void addServerSpecificValues(Map<String, Object> configValues) {
|
private void addServerSpecificValues(Map<String, Object> configValues) {
|
||||||
logger.debug("NetworkSettings: Adding Server-specific Config Values..");
|
logger.debug("NetworkSettings: Adding Server-specific Config Values..");
|
||||||
|
|
||||||
for (UUID serverUUID : database.get().fetch().getServerUUIDs()) {
|
for (UUID serverUUID : dbSystem.get().getDatabase().fetch().getServerUUIDs()) {
|
||||||
String theme = serverSpecificSettings.getString(serverUUID, THEME_BASE);
|
String theme = serverSpecificSettings.getString(serverUUID, THEME_BASE);
|
||||||
Integer port = serverSpecificSettings.getInt(serverUUID, WEBSERVER_PORT);
|
Integer port = serverSpecificSettings.getInt(serverUUID, WEBSERVER_PORT);
|
||||||
String name = serverSpecificSettings.getString(serverUUID, SERVER_NAME);
|
String name = serverSpecificSettings.getString(serverUUID, SERVER_NAME);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
package com.djrapitops.plan.system.webserver;
|
package com.djrapitops.plan.system.webserver;
|
||||||
|
|
||||||
import com.djrapitops.plan.system.DebugChannels;
|
import com.djrapitops.plan.system.DebugChannels;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
import com.djrapitops.plan.system.locale.Locale;
|
import com.djrapitops.plan.system.locale.Locale;
|
||||||
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;
|
||||||
@ -39,7 +39,7 @@ public class RequestHandler implements HttpHandler {
|
|||||||
private final Locale locale;
|
private final Locale locale;
|
||||||
private final PlanConfig config;
|
private final PlanConfig config;
|
||||||
private final Theme theme;
|
private final Theme theme;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final ResponseHandler responseHandler;
|
private final ResponseHandler responseHandler;
|
||||||
private final Timings timings;
|
private final Timings timings;
|
||||||
private final PluginLogger logger;
|
private final PluginLogger logger;
|
||||||
@ -50,7 +50,7 @@ public class RequestHandler implements HttpHandler {
|
|||||||
Locale locale,
|
Locale locale,
|
||||||
PlanConfig config,
|
PlanConfig config,
|
||||||
Theme theme,
|
Theme theme,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
ResponseHandler responseHandler,
|
ResponseHandler responseHandler,
|
||||||
Timings timings,
|
Timings timings,
|
||||||
PluginLogger logger,
|
PluginLogger logger,
|
||||||
@ -59,7 +59,7 @@ public class RequestHandler implements HttpHandler {
|
|||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.theme = theme;
|
this.theme = theme;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.responseHandler = responseHandler;
|
this.responseHandler = responseHandler;
|
||||||
this.timings = timings;
|
this.timings = timings;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
@ -111,7 +111,7 @@ public class RequestHandler implements HttpHandler {
|
|||||||
|
|
||||||
String authLine = authorization.get(0);
|
String authLine = authorization.get(0);
|
||||||
if (authLine.contains("Basic ")) {
|
if (authLine.contains("Basic ")) {
|
||||||
return new BasicAuthentication(authLine.split(" ")[1], database);
|
return new BasicAuthentication(authLine.split(" ")[1], dbSystem.getDatabase());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import com.djrapitops.plan.api.exceptions.WebUserAuthException;
|
|||||||
import com.djrapitops.plan.api.exceptions.connection.NoServersException;
|
import com.djrapitops.plan.api.exceptions.connection.NoServersException;
|
||||||
import com.djrapitops.plan.api.exceptions.connection.WebException;
|
import com.djrapitops.plan.api.exceptions.connection.WebException;
|
||||||
import com.djrapitops.plan.data.WebUser;
|
import com.djrapitops.plan.data.WebUser;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
import com.djrapitops.plan.system.info.InfoSystem;
|
import com.djrapitops.plan.system.info.InfoSystem;
|
||||||
import com.djrapitops.plan.system.webserver.Request;
|
import com.djrapitops.plan.system.webserver.Request;
|
||||||
import com.djrapitops.plan.system.webserver.auth.Authentication;
|
import com.djrapitops.plan.system.webserver.auth.Authentication;
|
||||||
@ -33,19 +33,19 @@ import java.util.UUID;
|
|||||||
public class PlayerPageHandler implements PageHandler {
|
public class PlayerPageHandler implements PageHandler {
|
||||||
|
|
||||||
private final ResponseFactory responseFactory;
|
private final ResponseFactory responseFactory;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final InfoSystem infoSystem;
|
private final InfoSystem infoSystem;
|
||||||
private final UUIDUtility uuidUtility;
|
private final UUIDUtility uuidUtility;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public PlayerPageHandler(
|
public PlayerPageHandler(
|
||||||
ResponseFactory responseFactory,
|
ResponseFactory responseFactory,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
InfoSystem infoSystem,
|
InfoSystem infoSystem,
|
||||||
UUIDUtility uuidUtility
|
UUIDUtility uuidUtility
|
||||||
) {
|
) {
|
||||||
this.responseFactory = responseFactory;
|
this.responseFactory = responseFactory;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.infoSystem = infoSystem;
|
this.infoSystem = infoSystem;
|
||||||
this.uuidUtility = uuidUtility;
|
this.uuidUtility = uuidUtility;
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@ public class PlayerPageHandler implements PageHandler {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// TODO Move this Database dependency to PlayerPage generation in PageFactory instead.
|
// TODO Move this Database dependency to PlayerPage generation in PageFactory instead.
|
||||||
if (database.check().isPlayerRegistered(uuid)) {
|
if (dbSystem.getDatabase().check().isPlayerRegistered(uuid)) {
|
||||||
if (raw) {
|
if (raw) {
|
||||||
return ResponseCache.loadResponse(PageId.RAW_PLAYER.of(uuid), () -> responseFactory.rawPlayerPageResponse(uuid));
|
return ResponseCache.loadResponse(PageId.RAW_PLAYER.of(uuid), () -> responseFactory.rawPlayerPageResponse(uuid));
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import com.djrapitops.plan.api.exceptions.WebUserAuthException;
|
|||||||
import com.djrapitops.plan.api.exceptions.connection.ConnectionFailException;
|
import com.djrapitops.plan.api.exceptions.connection.ConnectionFailException;
|
||||||
import com.djrapitops.plan.api.exceptions.connection.NoServersException;
|
import com.djrapitops.plan.api.exceptions.connection.NoServersException;
|
||||||
import com.djrapitops.plan.api.exceptions.connection.WebException;
|
import com.djrapitops.plan.api.exceptions.connection.WebException;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
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;
|
||||||
import com.djrapitops.plan.system.processing.Processing;
|
import com.djrapitops.plan.system.processing.Processing;
|
||||||
@ -36,7 +36,7 @@ public class ServerPageHandler implements PageHandler {
|
|||||||
|
|
||||||
private final Processing processing;
|
private final Processing processing;
|
||||||
private final ResponseFactory responseFactory;
|
private final ResponseFactory responseFactory;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final ServerInfo serverInfo;
|
private final ServerInfo serverInfo;
|
||||||
private final InfoSystem infoSystem;
|
private final InfoSystem infoSystem;
|
||||||
|
|
||||||
@ -44,13 +44,13 @@ public class ServerPageHandler implements PageHandler {
|
|||||||
public ServerPageHandler(
|
public ServerPageHandler(
|
||||||
Processing processing,
|
Processing processing,
|
||||||
ResponseFactory responseFactory,
|
ResponseFactory responseFactory,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
ServerInfo serverInfo,
|
ServerInfo serverInfo,
|
||||||
InfoSystem infoSystem
|
InfoSystem infoSystem
|
||||||
) {
|
) {
|
||||||
this.processing = processing;
|
this.processing = processing;
|
||||||
this.responseFactory = responseFactory;
|
this.responseFactory = responseFactory;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.serverInfo = serverInfo;
|
this.serverInfo = serverInfo;
|
||||||
this.infoSystem = infoSystem;
|
this.infoSystem = infoSystem;
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ public class ServerPageHandler implements PageHandler {
|
|||||||
if (!target.isEmpty()) {
|
if (!target.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
String serverName = target.get(0).replace("%20", " ");
|
String serverName = target.get(0).replace("%20", " ");
|
||||||
Optional<UUID> serverUUIDOptional = database.fetch().getServerUUID(serverName);
|
Optional<UUID> serverUUIDOptional = dbSystem.getDatabase().fetch().getServerUUID(serverName);
|
||||||
if (serverUUIDOptional.isPresent()) {
|
if (serverUUIDOptional.isPresent()) {
|
||||||
serverUUID = serverUUIDOptional.get();
|
serverUUID = serverUUIDOptional.get();
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.djrapitops.plan.system.webserver.response;
|
|||||||
|
|
||||||
import com.djrapitops.plan.api.exceptions.ParseException;
|
import com.djrapitops.plan.api.exceptions.ParseException;
|
||||||
import com.djrapitops.plan.api.exceptions.WebUserAuthException;
|
import com.djrapitops.plan.api.exceptions.WebUserAuthException;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
import com.djrapitops.plan.system.file.PlanFiles;
|
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.ErrorPageLang;
|
import com.djrapitops.plan.system.locale.lang.ErrorPageLang;
|
||||||
@ -30,7 +30,7 @@ public class ResponseFactory {
|
|||||||
private final PlanFiles files;
|
private final PlanFiles files;
|
||||||
private final PageFactory pageFactory;
|
private final PageFactory pageFactory;
|
||||||
private final Locale locale;
|
private final Locale locale;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final ErrorHandler errorHandler;
|
private final ErrorHandler errorHandler;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@ -39,14 +39,14 @@ public class ResponseFactory {
|
|||||||
PlanFiles files,
|
PlanFiles files,
|
||||||
PageFactory pageFactory,
|
PageFactory pageFactory,
|
||||||
Locale locale,
|
Locale locale,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
ErrorHandler errorHandler
|
ErrorHandler errorHandler
|
||||||
) {
|
) {
|
||||||
this.version = version;
|
this.version = version;
|
||||||
this.files = files;
|
this.files = files;
|
||||||
this.pageFactory = pageFactory;
|
this.pageFactory = pageFactory;
|
||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,11 +88,11 @@ public class ResponseFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public RawDataResponse rawPlayerPageResponse(UUID uuid) {
|
public RawDataResponse rawPlayerPageResponse(UUID uuid) {
|
||||||
return new RawPlayerDataResponse(database.fetch().getPlayerContainer(uuid));
|
return new RawPlayerDataResponse(dbSystem.getDatabase().fetch().getPlayerContainer(uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
public RawDataResponse rawServerPageResponse(UUID serverUUID) {
|
public RawDataResponse rawServerPageResponse(UUID serverUUID) {
|
||||||
return new RawServerDataResponse(database.fetch().getServerContainer(serverUUID));
|
return new RawServerDataResponse(dbSystem.getDatabase().fetch().getServerContainer(serverUUID));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Response javaScriptResponse(String fileName) {
|
public Response javaScriptResponse(String fileName) {
|
||||||
|
@ -8,7 +8,7 @@ import com.djrapitops.plan.PlanPlugin;
|
|||||||
import com.djrapitops.plan.api.exceptions.ParseException;
|
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.DBSystem;
|
||||||
import com.djrapitops.plan.system.file.PlanFiles;
|
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;
|
||||||
@ -43,7 +43,7 @@ public class HtmlExport extends SpecificExport {
|
|||||||
private final Theme theme;
|
private final Theme theme;
|
||||||
private final Processing processing;
|
private final Processing processing;
|
||||||
private final PlanFiles files;
|
private final PlanFiles files;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final PageFactory pageFactory;
|
private final PageFactory pageFactory;
|
||||||
private final ConnectionSystem connectionSystem;
|
private final ConnectionSystem connectionSystem;
|
||||||
private final ErrorHandler errorHandler;
|
private final ErrorHandler errorHandler;
|
||||||
@ -55,7 +55,7 @@ public class HtmlExport extends SpecificExport {
|
|||||||
PlanConfig config,
|
PlanConfig config,
|
||||||
Theme theme,
|
Theme theme,
|
||||||
Processing processing,
|
Processing processing,
|
||||||
Database database,
|
DBSystem dbSystem,
|
||||||
PageFactory pageFactory,
|
PageFactory pageFactory,
|
||||||
ServerInfo serverInfo,
|
ServerInfo serverInfo,
|
||||||
ConnectionSystem connectionSystem,
|
ConnectionSystem connectionSystem,
|
||||||
@ -66,7 +66,7 @@ public class HtmlExport extends SpecificExport {
|
|||||||
this.theme = theme;
|
this.theme = theme;
|
||||||
this.processing = processing;
|
this.processing = processing;
|
||||||
this.files = files;
|
this.files = files;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.pageFactory = pageFactory;
|
this.pageFactory = pageFactory;
|
||||||
this.connectionSystem = connectionSystem;
|
this.connectionSystem = connectionSystem;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
@ -76,7 +76,7 @@ public class HtmlExport extends SpecificExport {
|
|||||||
if (Check.isBukkitAvailable() && connectionSystem.isServerAvailable()) {
|
if (Check.isBukkitAvailable() && connectionSystem.isServerAvailable()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Optional<String> serverName = database.fetch().getServerName(serverUUID);
|
Optional<String> serverName = dbSystem.getDatabase().fetch().getServerName(serverUUID);
|
||||||
serverName.ifPresent(name -> processing.submitNonCritical(() -> {
|
serverName.ifPresent(name -> processing.submitNonCritical(() -> {
|
||||||
try {
|
try {
|
||||||
exportAvailableServerPage(serverUUID, name);
|
exportAvailableServerPage(serverUUID, name);
|
||||||
@ -90,7 +90,7 @@ public class HtmlExport extends SpecificExport {
|
|||||||
if (Check.isBukkitAvailable() && connectionSystem.isServerAvailable()) {
|
if (Check.isBukkitAvailable() && connectionSystem.isServerAvailable()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String playerName = database.fetch().getPlayerName(uuid);
|
String playerName = dbSystem.getDatabase().fetch().getPlayerName(uuid);
|
||||||
if (playerName != null) {
|
if (playerName != null) {
|
||||||
processing.submitNonCritical(() -> {
|
processing.submitNonCritical(() -> {
|
||||||
try {
|
try {
|
||||||
@ -137,13 +137,13 @@ public class HtmlExport extends SpecificExport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void exportAvailablePlayers() throws IOException {
|
private void exportAvailablePlayers() throws IOException {
|
||||||
for (Map.Entry<UUID, UserInfo> entry : database.fetch().getUsers().entrySet()) {
|
for (Map.Entry<UUID, UserInfo> entry : dbSystem.getDatabase().fetch().getUsers().entrySet()) {
|
||||||
exportAvailablePlayerPage(entry.getKey(), entry.getValue().getName());
|
exportAvailablePlayerPage(entry.getKey(), entry.getValue().getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void exportAvailableServerPages() throws IOException {
|
private void exportAvailableServerPages() throws IOException {
|
||||||
Map<UUID, String> serverNames = database.fetch().getServerNames();
|
Map<UUID, String> serverNames = dbSystem.getDatabase().fetch().getServerNames();
|
||||||
|
|
||||||
for (Map.Entry<UUID, String> entry : serverNames.entrySet()) {
|
for (Map.Entry<UUID, String> entry : serverNames.entrySet()) {
|
||||||
exportAvailableServerPage(entry.getKey(), entry.getValue());
|
exportAvailableServerPage(entry.getKey(), entry.getValue());
|
||||||
|
@ -4,7 +4,8 @@ import com.djrapitops.plan.data.plugin.HookHandler;
|
|||||||
import com.djrapitops.plan.data.store.containers.AnalysisContainer;
|
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.DBSystem;
|
||||||
|
import com.djrapitops.plan.system.database.databases.operation.FetchOperations;
|
||||||
import com.djrapitops.plan.system.file.PlanFiles;
|
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;
|
||||||
@ -39,7 +40,7 @@ public class PageFactory {
|
|||||||
private final Lazy<PlanFiles> 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<DBSystem> dbSystem;
|
||||||
private final Lazy<ServerInfo> serverInfo;
|
private final Lazy<ServerInfo> serverInfo;
|
||||||
private final Lazy<ConnectionSystem> connectionSystem;
|
private final Lazy<ConnectionSystem> connectionSystem;
|
||||||
private final Lazy<Graphs> graphs;
|
private final Lazy<Graphs> graphs;
|
||||||
@ -59,7 +60,7 @@ public class PageFactory {
|
|||||||
Lazy<PlanFiles> fileSystem,
|
Lazy<PlanFiles> fileSystem,
|
||||||
Lazy<PlanConfig> config,
|
Lazy<PlanConfig> config,
|
||||||
Lazy<Theme> theme,
|
Lazy<Theme> theme,
|
||||||
Lazy<Database> database,
|
Lazy<DBSystem> dbSystem,
|
||||||
Lazy<ServerInfo> serverInfo,
|
Lazy<ServerInfo> serverInfo,
|
||||||
Lazy<ConnectionSystem> connectionSystem,
|
Lazy<ConnectionSystem> connectionSystem,
|
||||||
Lazy<Graphs> graphs,
|
Lazy<Graphs> graphs,
|
||||||
@ -77,7 +78,7 @@ public class PageFactory {
|
|||||||
this.fileSystem = fileSystem;
|
this.fileSystem = fileSystem;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.theme = theme;
|
this.theme = theme;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.serverInfo = serverInfo;
|
this.serverInfo = serverInfo;
|
||||||
this.connectionSystem = connectionSystem;
|
this.connectionSystem = connectionSystem;
|
||||||
this.graphs = graphs;
|
this.graphs = graphs;
|
||||||
@ -95,26 +96,27 @@ public class PageFactory {
|
|||||||
public DebugPage debugPage() {
|
public DebugPage debugPage() {
|
||||||
return new DebugPage(
|
return new DebugPage(
|
||||||
version,
|
version,
|
||||||
database.get(), serverInfo.get(), connectionSystem.get(), formatters.get(),
|
dbSystem.get().getDatabase(), serverInfo.get(), connectionSystem.get(), formatters.get(),
|
||||||
debugLogger.get(), timings.get(), errorHandler.get()
|
debugLogger.get(), timings.get(), errorHandler.get()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayersPage playersPage() {
|
public PlayersPage playersPage() {
|
||||||
return new PlayersPage(version, fileSystem.get(), config.get(),
|
return new PlayersPage(version, fileSystem.get(), config.get(),
|
||||||
database.get(), serverInfo.get(), tables.get(),
|
dbSystem.get().getDatabase(), serverInfo.get(), tables.get(),
|
||||||
timings.get());
|
timings.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
public AnalysisPage analysisPage(UUID serverUUID) {
|
public AnalysisPage analysisPage(UUID serverUUID) {
|
||||||
AnalysisContainer analysisContainer = analysisContainerFactory.get()
|
AnalysisContainer analysisContainer = analysisContainerFactory.get()
|
||||||
.forServerContainer(database.get().fetch().getServerContainer(serverUUID));
|
.forServerContainer(dbSystem.get().getDatabase().fetch().getServerContainer(serverUUID));
|
||||||
return new AnalysisPage(analysisContainer, fileSystem.get(), formatters.get().decimals(), timings.get());
|
return new AnalysisPage(analysisContainer, fileSystem.get(), formatters.get().decimals(), timings.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
public InspectPage inspectPage(UUID uuid) {
|
public InspectPage inspectPage(UUID uuid) {
|
||||||
PlayerContainer player = database.get().fetch().getPlayerContainer(uuid);
|
FetchOperations fetch = dbSystem.get().getDatabase().fetch();
|
||||||
Map<UUID, String> serverNames = database.get().fetch().getServerNames();
|
PlayerContainer player = fetch.getPlayerContainer(uuid);
|
||||||
|
Map<UUID, String> serverNames = fetch.getServerNames();
|
||||||
return new InspectPage(
|
return new InspectPage(
|
||||||
player, serverNames,
|
player, serverNames,
|
||||||
version,
|
version,
|
||||||
@ -129,7 +131,7 @@ public class PageFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public NetworkPage networkPage() {
|
public NetworkPage networkPage() {
|
||||||
NetworkContainer networkContainer = database.get().fetch().getNetworkContainer(); // Not cached, big.
|
NetworkContainer networkContainer = dbSystem.get().getDatabase().fetch().getNetworkContainer(); // Not cached, big.
|
||||||
return new NetworkPage(networkContainer,
|
return new NetworkPage(networkContainer,
|
||||||
analysisPluginsTabContentCreator.get(),
|
analysisPluginsTabContentCreator.get(),
|
||||||
fileSystem.get(), serverInfo.get().getServerProperties());
|
fileSystem.get(), serverInfo.get().getServerProperties());
|
||||||
|
@ -25,7 +25,7 @@ public class BStatsBukkit {
|
|||||||
if ("CraftBukkit".equals(serverType) && Check.isSpigotAvailable()) {
|
if ("CraftBukkit".equals(serverType) && Check.isSpigotAvailable()) {
|
||||||
serverType = "Spigot";
|
serverType = "Spigot";
|
||||||
}
|
}
|
||||||
String databaseType = plugin.getSystem().getDatabaseSystem().getActiveDatabase().getName();
|
String databaseType = plugin.getSystem().getDatabaseSystem().getDatabase().getName();
|
||||||
|
|
||||||
addStringSettingPie("server_type", serverType);
|
addStringSettingPie("server_type", serverType);
|
||||||
addStringSettingPie("database_type", databaseType);
|
addStringSettingPie("database_type", databaseType);
|
||||||
|
@ -7,7 +7,7 @@ package com.djrapitops.plan.utilities.uuid;
|
|||||||
|
|
||||||
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
||||||
import com.djrapitops.plan.system.cache.DataCache;
|
import com.djrapitops.plan.system.cache.DataCache;
|
||||||
import com.djrapitops.plan.system.database.databases.Database;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
import com.djrapitops.plugin.api.utility.UUIDFetcher;
|
import com.djrapitops.plugin.api.utility.UUIDFetcher;
|
||||||
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;
|
||||||
@ -23,13 +23,13 @@ import java.util.UUID;
|
|||||||
public class UUIDUtility {
|
public class UUIDUtility {
|
||||||
|
|
||||||
private final DataCache dataCache;
|
private final DataCache dataCache;
|
||||||
private final Database database;
|
private final DBSystem dbSystem;
|
||||||
private final ErrorHandler errorHandler;
|
private final ErrorHandler errorHandler;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public UUIDUtility(DataCache dataCache, Database database, ErrorHandler errorHandler) {
|
public UUIDUtility(DataCache dataCache, DBSystem dbSystem, ErrorHandler errorHandler) {
|
||||||
this.dataCache = dataCache;
|
this.dataCache = dataCache;
|
||||||
this.database = database;
|
this.dbSystem = dbSystem;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ public class UUIDUtility {
|
|||||||
return uuidOf;
|
return uuidOf;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
uuid = database.fetch().getUuidOf(playerName);
|
uuid = dbSystem.getDatabase().fetch().getUuidOf(playerName);
|
||||||
} catch (DBOpException e) {
|
} catch (DBOpException e) {
|
||||||
errorHandler.log(L.ERROR, UUIDUtility.class, e);
|
errorHandler.log(L.ERROR, UUIDUtility.class, e);
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,12 @@
|
|||||||
* License is provided in the jar as LICENSE also here:
|
* License is provided in the jar as LICENSE also here:
|
||||||
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/LICENSE
|
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/LICENSE
|
||||||
*/
|
*/
|
||||||
package com.djrapitops.plan.system;
|
package com.djrapitops.plan;
|
||||||
|
|
||||||
import com.djrapitops.plan.Plan;
|
|
||||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||||
|
import com.djrapitops.plan.system.PlanSystem;
|
||||||
|
import com.djrapitops.plan.system.settings.Settings;
|
||||||
|
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
import org.junit.rules.TemporaryFolder;
|
import org.junit.rules.TemporaryFolder;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@ -22,18 +24,22 @@ public class BukkitSystemTest {
|
|||||||
|
|
||||||
@ClassRule
|
@ClassRule
|
||||||
public static TemporaryFolder temporaryFolder = new TemporaryFolder();
|
public static TemporaryFolder temporaryFolder = new TemporaryFolder();
|
||||||
private static Plan planMock;
|
|
||||||
private PlanSystem bukkitSystem;
|
private PlanSystem bukkitSystem;
|
||||||
|
private static PlanComponent COMPONENT;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUpClass() throws Exception {
|
public static void setUpClass() throws Exception {
|
||||||
PlanBukkitMocker mockUtil = PlanBukkitMocker.setUp()
|
PlanBukkitMocker mockUtil = PlanBukkitMocker.setUp()
|
||||||
.withDataFolder(temporaryFolder.getRoot())
|
.withDataFolder(temporaryFolder.newFolder())
|
||||||
.withLogging()
|
|
||||||
.withPluginDescription()
|
.withPluginDescription()
|
||||||
.withResourceFetchingFromJar()
|
.withResourceFetchingFromJar()
|
||||||
.withServer();
|
.withServer();
|
||||||
planMock = mockUtil.getPlanMock();
|
COMPONENT = DaggerPlanComponent.builder().plan(mockUtil.getPlanMock()).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
bukkitSystem = COMPONENT.system();
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
@ -44,11 +50,9 @@ public class BukkitSystemTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore
|
|
||||||
public void testEnable() throws EnableException {
|
public void testEnable() throws EnableException {
|
||||||
// Settings.WEBSERVER_PORT.setTemporaryValue(9005);
|
PlanConfig config = bukkitSystem.getConfigSystem().getConfig();
|
||||||
|
config.set(Settings.WEBSERVER_PORT, 9005);
|
||||||
bukkitSystem = null; //TODO
|
|
||||||
bukkitSystem.enable();
|
bukkitSystem.enable();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,11 +2,10 @@
|
|||||||
* License is provided in the jar as LICENSE also here:
|
* License is provided in the jar as LICENSE also here:
|
||||||
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/LICENSE
|
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/LICENSE
|
||||||
*/
|
*/
|
||||||
package com.djrapitops.plan.system;
|
package com.djrapitops.plan;
|
||||||
|
|
||||||
import com.djrapitops.plan.Plan;
|
|
||||||
import com.djrapitops.plan.PlanBungee;
|
|
||||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||||
|
import com.djrapitops.plan.system.PlanSystem;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
import org.junit.rules.ExpectedException;
|
import org.junit.rules.ExpectedException;
|
||||||
import org.junit.rules.TemporaryFolder;
|
import org.junit.rules.TemporaryFolder;
|
@ -2,10 +2,10 @@
|
|||||||
* License is provided in the jar as LICENSE also here:
|
* License is provided in the jar as LICENSE also here:
|
||||||
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/LICENSE
|
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/LICENSE
|
||||||
*/
|
*/
|
||||||
package com.djrapitops.plan.system;
|
package com.djrapitops.plan;
|
||||||
|
|
||||||
import com.djrapitops.plan.PlanBungee;
|
|
||||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||||
|
import com.djrapitops.plan.system.PlanSystem;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
import org.junit.rules.ExpectedException;
|
import org.junit.rules.ExpectedException;
|
||||||
import org.junit.rules.TemporaryFolder;
|
import org.junit.rules.TemporaryFolder;
|
@ -2,10 +2,10 @@
|
|||||||
* License is provided in the jar as LICENSE also here:
|
* License is provided in the jar as LICENSE also here:
|
||||||
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/LICENSE
|
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/LICENSE
|
||||||
*/
|
*/
|
||||||
package com.djrapitops.plan.system;
|
package com.djrapitops.plan;
|
||||||
|
|
||||||
import com.djrapitops.plan.PlanSponge;
|
|
||||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||||
|
import com.djrapitops.plan.system.PlanSystem;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
import org.junit.rules.TemporaryFolder;
|
import org.junit.rules.TemporaryFolder;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
@ -49,7 +49,7 @@ public class HTTPSWebServerAuthTest {
|
|||||||
bukkitSystem = null; //TODO
|
bukkitSystem = null; //TODO
|
||||||
// bukkitSystem.enable();
|
// bukkitSystem.enable();
|
||||||
//
|
//
|
||||||
// bukkitSystem.getDatabaseSystem().getActiveDatabase().save()
|
// bukkitSystem.getDatabaseSystem().getDatabase().save()
|
||||||
// .webUser(new WebUser("test", PassEncryptUtil.createHash("testPass"), 0));
|
// .webUser(new WebUser("test", PassEncryptUtil.createHash("testPass"), 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,8 +5,15 @@
|
|||||||
package utilities.mocks;
|
package utilities.mocks;
|
||||||
|
|
||||||
import com.djrapitops.plan.Plan;
|
import com.djrapitops.plan.Plan;
|
||||||
|
import com.djrapitops.plugin.benchmarking.Timings;
|
||||||
|
import com.djrapitops.plugin.command.ColorScheme;
|
||||||
|
import com.djrapitops.plugin.logging.console.PluginLogger;
|
||||||
import com.djrapitops.plugin.logging.console.TestPluginLogger;
|
import com.djrapitops.plugin.logging.console.TestPluginLogger;
|
||||||
|
import com.djrapitops.plugin.logging.debug.CombineDebugLogger;
|
||||||
|
import com.djrapitops.plugin.logging.debug.DebugLogger;
|
||||||
|
import com.djrapitops.plugin.logging.debug.MemoryDebugLogger;
|
||||||
import com.djrapitops.plugin.logging.error.ConsoleErrorLogger;
|
import com.djrapitops.plugin.logging.error.ConsoleErrorLogger;
|
||||||
|
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||||
import com.djrapitops.plugin.task.thread.ThreadRunnableFactory;
|
import com.djrapitops.plugin.task.thread.ThreadRunnableFactory;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.ConsoleCommandSender;
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
@ -21,7 +28,6 @@ import java.io.File;
|
|||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
|
||||||
import static org.mockito.Mockito.doCallRealMethod;
|
|
||||||
import static org.mockito.Mockito.doReturn;
|
import static org.mockito.Mockito.doReturn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -44,11 +50,22 @@ public class PlanBukkitMocker extends Mocker {
|
|||||||
planMock = Mockito.mock(Plan.class);
|
planMock = Mockito.mock(Plan.class);
|
||||||
super.planMock = planMock;
|
super.planMock = planMock;
|
||||||
|
|
||||||
doCallRealMethod().when(planMock).getVersion();
|
doReturn(new ColorScheme("§1", "§2", "§3")).when(planMock).getColorScheme();
|
||||||
doCallRealMethod().when(planMock).getColorScheme();
|
doReturn("1.0.0").when(planMock).getVersion();
|
||||||
|
|
||||||
|
TestLogger testLogger = new TestLogger();
|
||||||
ThreadRunnableFactory runnableFactory = new ThreadRunnableFactory();
|
ThreadRunnableFactory runnableFactory = new ThreadRunnableFactory();
|
||||||
|
PluginLogger testPluginLogger = new TestPluginLogger();
|
||||||
|
DebugLogger debugLogger = new CombineDebugLogger(new MemoryDebugLogger());
|
||||||
|
ErrorHandler consoleErrorLogger = new ConsoleErrorLogger(testPluginLogger);
|
||||||
|
Timings timings = new Timings(debugLogger);
|
||||||
|
|
||||||
|
doReturn(testLogger).when(planMock).getLogger();
|
||||||
doReturn(runnableFactory).when(planMock).getRunnableFactory();
|
doReturn(runnableFactory).when(planMock).getRunnableFactory();
|
||||||
|
doReturn(testPluginLogger).when(planMock).getPluginLogger();
|
||||||
|
doReturn(debugLogger).when(planMock).getDebugLogger();
|
||||||
|
doReturn(consoleErrorLogger).when(planMock).getErrorHandler();
|
||||||
|
doReturn(timings).when(planMock).getTimings();
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -58,13 +75,8 @@ public class PlanBukkitMocker extends Mocker {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public PlanBukkitMocker withLogging() {
|
public PlanBukkitMocker withLogging() {
|
||||||
TestLogger testLogger = new TestLogger();
|
|
||||||
doReturn(testLogger).when(planMock).getLogger();
|
|
||||||
TestPluginLogger testPluginLogger = new TestPluginLogger();
|
|
||||||
doReturn(testPluginLogger).when(planMock).getPluginLogger();
|
|
||||||
ConsoleErrorLogger consoleErrorLogger = new ConsoleErrorLogger(testPluginLogger);
|
|
||||||
doReturn(consoleErrorLogger).when(planMock).getErrorHandler();
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package module;
|
package utilities.module;
|
||||||
|
|
||||||
import com.djrapitops.plan.PlanPlugin;
|
import com.djrapitops.plan.PlanPlugin;
|
||||||
import com.djrapitops.plugin.IPlugin;
|
import com.djrapitops.plugin.IPlugin;
|
Loading…
Reference in New Issue
Block a user