From 81a6ed7365674960a368060176337a54e0f4ce7b Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Tue, 21 Aug 2018 18:33:40 +0300 Subject: [PATCH] UUIDUtility & PlanAPI initialized by Dagger - needs singleton --- .../java/com/djrapitops/plan/PlanBungee.java | 5 ++- .../com/djrapitops/plan/api/BungeeAPI.java | 32 ++++++++++++---- .../com/djrapitops/plan/api/CommonAPI.java | 15 ++++++-- .../com/djrapitops/plan/api/ServerAPI.java | 11 +++++- .../plan/command/commands/InspectCommand.java | 12 +++++- .../command/commands/QInspectCommand.java | 11 +++++- .../commands/manage/ManageRemoveCommand.java | 11 +++++- .../plan/modules/bungee/BungeeAPIModule.java | 21 ++++++++++ .../plan/modules/server/ServerAPIModule.java | 7 +--- .../djrapitops/plan/system/BukkitSystem.java | 6 +-- .../djrapitops/plan/system/BungeeSystem.java | 12 +++--- .../djrapitops/plan/system/PlanSystem.java | 1 + .../djrapitops/plan/system/SpongeSystem.java | 6 +-- .../webserver/pages/PlayerPageHandler.java | 2 +- .../plan/utilities/uuid/UUIDUtility.java | 38 ++++++++++--------- 15 files changed, 136 insertions(+), 54 deletions(-) create mode 100644 Plan/src/main/java/com/djrapitops/plan/modules/bungee/BungeeAPIModule.java diff --git a/Plan/src/main/java/com/djrapitops/plan/PlanBungee.java b/Plan/src/main/java/com/djrapitops/plan/PlanBungee.java index c2e123d81..8222184b0 100644 --- a/Plan/src/main/java/com/djrapitops/plan/PlanBungee.java +++ b/Plan/src/main/java/com/djrapitops/plan/PlanBungee.java @@ -7,6 +7,7 @@ package com.djrapitops.plan; import com.djrapitops.plan.api.exceptions.EnableException; import com.djrapitops.plan.command.PlanBungeeCommand; import com.djrapitops.plan.modules.APFModule; +import com.djrapitops.plan.modules.bungee.BungeeAPIModule; import com.djrapitops.plan.modules.bungee.BungeeConfigModule; import com.djrapitops.plan.modules.bungee.BungeeDatabaseModule; import com.djrapitops.plan.modules.common.*; @@ -43,7 +44,8 @@ import java.io.InputStream; BungeeDatabaseModule.class, WebServerSystemModule.class, ServerInfoSystemModule.class, - PluginHookModule.class + PluginHookModule.class, + BungeeAPIModule.class }) interface PlanBungeeComponent { @@ -54,6 +56,7 @@ interface PlanBungeeComponent { @Component.Builder interface Builder { + @Singleton @BindsInstance Builder plan(PlanBungee plan); diff --git a/Plan/src/main/java/com/djrapitops/plan/api/BungeeAPI.java b/Plan/src/main/java/com/djrapitops/plan/api/BungeeAPI.java index 394231e52..5d80a8391 100644 --- a/Plan/src/main/java/com/djrapitops/plan/api/BungeeAPI.java +++ b/Plan/src/main/java/com/djrapitops/plan/api/BungeeAPI.java @@ -4,10 +4,15 @@ */ package com.djrapitops.plan.api; +import com.djrapitops.plan.data.plugin.HookHandler; import com.djrapitops.plan.data.plugin.PluginData; -import com.djrapitops.plan.system.BungeeSystem; +import com.djrapitops.plan.system.cache.DataCache; +import com.djrapitops.plan.system.database.databases.Database; import com.djrapitops.plan.system.database.databases.operation.FetchOperations; +import com.djrapitops.plan.utilities.uuid.UUIDUtility; +import com.djrapitops.plugin.logging.error.ErrorHandler; +import javax.inject.Inject; import java.util.UUID; /** @@ -17,24 +22,37 @@ import java.util.UUID; */ public class BungeeAPI extends CommonAPI { - private final BungeeSystem bungeeSystem; + private final HookHandler hookHandler; + private final Database database; + private final DataCache dataCache; - public BungeeAPI(BungeeSystem bungeeSystem) { - this.bungeeSystem = bungeeSystem; + @Inject + public BungeeAPI( + UUIDUtility uuidUtility, + Database database, + DataCache dataCache, + HookHandler hookHandler, + ErrorHandler errorHandler + ) { + super(uuidUtility, errorHandler); + + this.database = database; + this.dataCache = dataCache; + this.hookHandler = hookHandler; } @Override public void addPluginDataSource(PluginData pluginData) { - bungeeSystem.getHookHandler().addPluginDataSource(pluginData); + hookHandler.addPluginDataSource(pluginData); } @Override public String getPlayerName(UUID uuid) { - return bungeeSystem.getCacheSystem().getDataCache().getName(uuid); + return dataCache.getName(uuid); } @Override public FetchOperations fetchFromPlanDB() { - return bungeeSystem.getDatabaseSystem().getActiveDatabase().fetch(); + return database.fetch(); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/api/CommonAPI.java b/Plan/src/main/java/com/djrapitops/plan/api/CommonAPI.java index c87f9336d..9f602e726 100644 --- a/Plan/src/main/java/com/djrapitops/plan/api/CommonAPI.java +++ b/Plan/src/main/java/com/djrapitops/plan/api/CommonAPI.java @@ -6,7 +6,8 @@ package com.djrapitops.plan.api; import com.djrapitops.plan.api.exceptions.database.DBOpException; import com.djrapitops.plan.utilities.uuid.UUIDUtility; -import com.djrapitops.plugin.api.utility.log.Log; +import com.djrapitops.plugin.logging.L; +import com.djrapitops.plugin.logging.error.ErrorHandler; import java.util.HashMap; import java.util.Map; @@ -19,6 +20,14 @@ import java.util.UUID; */ public abstract class CommonAPI implements PlanAPI { + private final UUIDUtility uuidUtility; + private final ErrorHandler errorHandler; + + public CommonAPI(UUIDUtility uuidUtility, ErrorHandler errorHandler) { + this.uuidUtility = uuidUtility; + this.errorHandler = errorHandler; + } + @Override public String getPlayerInspectPageLink(UUID uuid) { return getPlayerInspectPageLink(getPlayerName(uuid)); @@ -31,7 +40,7 @@ public abstract class CommonAPI implements PlanAPI { @Override public UUID playerNameToUUID(String playerName) { - return UUIDUtility.getUUIDOf(playerName); + return uuidUtility.getUUIDOf(playerName); } @Override @@ -39,7 +48,7 @@ public abstract class CommonAPI implements PlanAPI { try { return fetchFromPlanDB().getPlayerNames(); } catch (DBOpException e) { - Log.toLog(this.getClass(), e); + errorHandler.log(L.ERROR, this.getClass(), e); return new HashMap<>(); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/api/ServerAPI.java b/Plan/src/main/java/com/djrapitops/plan/api/ServerAPI.java index 6563255f7..85047868e 100644 --- a/Plan/src/main/java/com/djrapitops/plan/api/ServerAPI.java +++ b/Plan/src/main/java/com/djrapitops/plan/api/ServerAPI.java @@ -9,6 +9,8 @@ import com.djrapitops.plan.data.plugin.PluginData; import com.djrapitops.plan.system.cache.DataCache; import com.djrapitops.plan.system.database.databases.Database; import com.djrapitops.plan.system.database.databases.operation.FetchOperations; +import com.djrapitops.plan.utilities.uuid.UUIDUtility; +import com.djrapitops.plugin.logging.error.ErrorHandler; import javax.inject.Inject; import java.util.UUID; @@ -25,7 +27,14 @@ public class ServerAPI extends CommonAPI { private final DataCache dataCache; @Inject - public ServerAPI(HookHandler hookHandler, Database activeDatabase, DataCache dataCache) { + public ServerAPI( + UUIDUtility uuidUtility, + HookHandler hookHandler, + Database activeDatabase, + DataCache dataCache, + ErrorHandler errorHandler + ) { + super(uuidUtility, errorHandler); this.hookHandler = hookHandler; this.activeDatabase = activeDatabase; this.dataCache = dataCache; diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/InspectCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/InspectCommand.java index e9fbd44eb..5e47bd2a1 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/InspectCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/InspectCommand.java @@ -33,16 +33,24 @@ public class InspectCommand extends CommandNode { private final Locale locale; private final Database database; private final WebServer webServer; + private UUIDUtility uuidUtility; private final ErrorHandler errorHandler; @Inject - public InspectCommand(Locale locale, Database database, WebServer webServer, ErrorHandler errorHandler) { + public InspectCommand( + Locale locale, + Database database, + WebServer webServer, + UUIDUtility uuidUtility, + ErrorHandler errorHandler + ) { super("inspect", Permissions.INSPECT.getPermission(), CommandType.PLAYER_OR_ARGS); setArguments(""); this.locale = locale; this.database = database; this.webServer = webServer; + this.uuidUtility = uuidUtility; this.errorHandler = errorHandler; setShortHelp(locale.getString(CmdHelpLang.INSPECT)); @@ -63,7 +71,7 @@ public class InspectCommand extends CommandNode { private void runInspectTask(String playerName, ISender sender) { Processing.submitNonCritical(() -> { try { - UUID uuid = UUIDUtility.getUUIDOf(playerName); + UUID uuid = uuidUtility.getUUIDOf(playerName); if (uuid == null) { sender.sendMessage(locale.getString(CommandLang.FAIL_USERNAME_NOT_VALID)); return; diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/QInspectCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/QInspectCommand.java index 585800ece..0afc763a0 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/QInspectCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/QInspectCommand.java @@ -42,15 +42,22 @@ public class QInspectCommand extends CommandNode { private final Locale locale; private final Database database; + private UUIDUtility uuidUtility; private final ErrorHandler errorHandler; @Inject - public QInspectCommand(Locale locale, Database database, ErrorHandler errorHandler) { + public QInspectCommand( + Locale locale, + Database database, + UUIDUtility uuidUtility, + ErrorHandler errorHandler + ) { super("qinspect", Permissions.QUICK_INSPECT.getPermission(), CommandType.PLAYER_OR_ARGS); setArguments(""); this.locale = locale; this.database = database; + this.uuidUtility = uuidUtility; this.errorHandler = errorHandler; setShortHelp(locale.getString(CmdHelpLang.QINSPECT)); @@ -72,7 +79,7 @@ public class QInspectCommand extends CommandNode { private void runInspectTask(String playerName, ISender sender) { Processing.submitNonCritical(() -> { try { - UUID uuid = UUIDUtility.getUUIDOf(playerName); + UUID uuid = uuidUtility.getUUIDOf(playerName); if (uuid == null) { sender.sendMessage(locale.getString(CommandLang.FAIL_USERNAME_NOT_VALID)); return; diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRemoveCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRemoveCommand.java index 5338e297d..b7b1af591 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRemoveCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRemoveCommand.java @@ -32,14 +32,21 @@ public class ManageRemoveCommand extends CommandNode { private final Locale locale; private final Database database; + private UUIDUtility uuidUtility; private final ErrorHandler errorHandler; @Inject - public ManageRemoveCommand(Locale locale, Database database, ErrorHandler errorHandler) { + public ManageRemoveCommand( + Locale locale, + Database database, + UUIDUtility uuidUtility, + ErrorHandler errorHandler + ) { super("remove|delete", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS); this.locale = locale; this.database = database; + this.uuidUtility = uuidUtility; this.errorHandler = errorHandler; setArguments("", "[-a]"); @@ -65,7 +72,7 @@ public class ManageRemoveCommand extends CommandNode { private void runRemoveTask(String playerName, ISender sender, String[] args) { Processing.submitCritical(() -> { try { - UUID uuid = UUIDUtility.getUUIDOf(playerName); + UUID uuid = uuidUtility.getUUIDOf(playerName); if (uuid == null) { sender.sendMessage(locale.getString(CommandLang.FAIL_USERNAME_NOT_VALID)); diff --git a/Plan/src/main/java/com/djrapitops/plan/modules/bungee/BungeeAPIModule.java b/Plan/src/main/java/com/djrapitops/plan/modules/bungee/BungeeAPIModule.java new file mode 100644 index 000000000..cf306d28e --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/modules/bungee/BungeeAPIModule.java @@ -0,0 +1,21 @@ +package com.djrapitops.plan.modules.bungee; + +import com.djrapitops.plan.api.BungeeAPI; +import com.djrapitops.plan.api.PlanAPI; +import dagger.Module; +import dagger.Provides; + +/** + * Dagger module for Bungee PlanAPI. + * + * @author Rsl1122 + */ +@Module +public class BungeeAPIModule { + + @Provides + PlanAPI providePlanAPI(BungeeAPI bungeeAPI) { + return bungeeAPI; + } + +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/modules/server/ServerAPIModule.java b/Plan/src/main/java/com/djrapitops/plan/modules/server/ServerAPIModule.java index 184528d60..43e1cd2a4 100644 --- a/Plan/src/main/java/com/djrapitops/plan/modules/server/ServerAPIModule.java +++ b/Plan/src/main/java/com/djrapitops/plan/modules/server/ServerAPIModule.java @@ -2,9 +2,6 @@ package com.djrapitops.plan.modules.server; import com.djrapitops.plan.api.PlanAPI; import com.djrapitops.plan.api.ServerAPI; -import com.djrapitops.plan.data.plugin.HookHandler; -import com.djrapitops.plan.system.cache.DataCache; -import com.djrapitops.plan.system.database.databases.Database; import dagger.Module; import dagger.Provides; @@ -17,8 +14,8 @@ import dagger.Provides; public class ServerAPIModule { @Provides - PlanAPI providePlanAPI(HookHandler hookHandler, DataCache dataCache, Database database) { - return new ServerAPI(hookHandler, database, dataCache); + PlanAPI providePlanAPI(ServerAPI serverAPI) { + return serverAPI; } } \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/system/BukkitSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/BukkitSystem.java index e6199f365..a4a41fec0 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/BukkitSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/BukkitSystem.java @@ -9,7 +9,7 @@ import com.djrapitops.plan.ShutdownHook; import com.djrapitops.plan.api.PlanAPI; import com.djrapitops.plan.api.exceptions.EnableException; import com.djrapitops.plan.data.plugin.HookHandler; -import com.djrapitops.plan.system.database.BukkitDBSystem; +import com.djrapitops.plan.system.database.DBSystem; import com.djrapitops.plan.system.export.ExportSystem; import com.djrapitops.plan.system.file.FileSystem; import com.djrapitops.plan.system.info.InfoSystem; @@ -35,7 +35,7 @@ public class BukkitSystem extends PlanSystem implements ServerSystem { ConfigSystem serverConfigSystem, InfoSystem serverInfoSystem, BukkitServerInfo serverInfo, - BukkitDBSystem bukkitDBSystem, + DBSystem databaseSystem, BukkitListenerSystem bukkitListenerSystem, BukkitTaskSystem bukkitTaskSystem, ExportSystem exportSystem, @@ -47,7 +47,7 @@ public class BukkitSystem extends PlanSystem implements ServerSystem { this.fileSystem = fileSystem; this.configSystem = serverConfigSystem; this.exportSystem = exportSystem; - this.databaseSystem = bukkitDBSystem; + this.databaseSystem = databaseSystem; listenerSystem = bukkitListenerSystem; taskSystem = bukkitTaskSystem; diff --git a/Plan/src/main/java/com/djrapitops/plan/system/BungeeSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/BungeeSystem.java index f4b4b6277..5dd185649 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/BungeeSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/BungeeSystem.java @@ -5,11 +5,10 @@ package com.djrapitops.plan.system; import com.djrapitops.plan.PlanBungee; -import com.djrapitops.plan.api.BungeeAPI; +import com.djrapitops.plan.api.PlanAPI; import com.djrapitops.plan.api.exceptions.EnableException; import com.djrapitops.plan.data.plugin.HookHandler; import com.djrapitops.plan.system.cache.BungeeCacheSystem; -import com.djrapitops.plan.system.database.BungeeDBSystem; import com.djrapitops.plan.system.database.DBSystem; import com.djrapitops.plan.system.export.ExportSystem; import com.djrapitops.plan.system.file.FileSystem; @@ -36,9 +35,10 @@ public class BungeeSystem extends PlanSystem { FileSystem fileSystem, BungeeConfigSystem bungeeConfigSystem, BungeeCacheSystem bungeeCacheSystem, - BungeeDBSystem bungeeDBSystem, + DBSystem databaseSystem, HookHandler hookHandler, - ExportSystem exportSystem + ExportSystem exportSystem, + PlanAPI planAPI ) { setTestSystem(this); @@ -46,7 +46,7 @@ public class BungeeSystem extends PlanSystem { this.fileSystem = fileSystem; configSystem = bungeeConfigSystem; this.exportSystem = exportSystem; - databaseSystem = bungeeDBSystem; + this.databaseSystem = databaseSystem; cacheSystem = bungeeCacheSystem; listenerSystem = new BungeeListenerSystem(plugin); taskSystem = new BungeeTaskSystem(plugin.getRunnableFactory()); @@ -55,7 +55,7 @@ public class BungeeSystem extends PlanSystem { serverInfo = new BungeeServerInfo(plugin); this.hookHandler = hookHandler; - planAPI = new BungeeAPI(this); + this.planAPI = planAPI; } public static BungeeSystem getInstance() { diff --git a/Plan/src/main/java/com/djrapitops/plan/system/PlanSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/PlanSystem.java index f8e984c91..60f17fc2d 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/PlanSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/PlanSystem.java @@ -69,6 +69,7 @@ public abstract class PlanSystem implements SubSystem { localeSystem = new LocaleSystem(); } + @Deprecated public static PlanSystem getInstance() { boolean bukkitAvailable = Check.isBukkitAvailable(); boolean bungeeAvailable = Check.isBungeeAvailable(); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/SpongeSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/SpongeSystem.java index da6977c14..0ed3fc979 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/SpongeSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/SpongeSystem.java @@ -9,7 +9,7 @@ import com.djrapitops.plan.ShutdownHook; import com.djrapitops.plan.api.PlanAPI; import com.djrapitops.plan.api.exceptions.EnableException; import com.djrapitops.plan.data.plugin.HookHandler; -import com.djrapitops.plan.system.database.SpongeDBSystem; +import com.djrapitops.plan.system.database.DBSystem; import com.djrapitops.plan.system.export.ExportSystem; import com.djrapitops.plan.system.file.FileSystem; import com.djrapitops.plan.system.info.InfoSystem; @@ -38,7 +38,7 @@ public class SpongeSystem extends PlanSystem implements ServerSystem { SpongeServerInfo serverInfo, SpongeListenerSystem spongeListenerSystem, SpongeTaskSystem spongeTaskSystem, - SpongeDBSystem spongeDBSystem, + DBSystem databaseSystem, ExportSystem exportSystem, HookHandler hookHandler, PlanAPI planAPI, @@ -50,7 +50,7 @@ public class SpongeSystem extends PlanSystem implements ServerSystem { this.fileSystem = fileSystem; this.configSystem = serverConfigSystem; this.exportSystem = exportSystem; - this.databaseSystem = spongeDBSystem; + this.databaseSystem = databaseSystem; listenerSystem = spongeListenerSystem; taskSystem = spongeTaskSystem; diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/PlayerPageHandler.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/PlayerPageHandler.java index f6527455a..3fe277e5b 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/PlayerPageHandler.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/PlayerPageHandler.java @@ -39,7 +39,7 @@ public class PlayerPageHandler extends PageHandler { } String playerName = target.get(0); - UUID uuid = UUIDUtility.getUUIDOf(playerName); + UUID uuid = UUIDUtility.getUUIDOf_Old(playerName); Locale locale = request.getLocale(); boolean raw = target.size() >= 2 && target.get(1).equalsIgnoreCase("raw"); diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/uuid/UUIDUtility.java b/Plan/src/main/java/com/djrapitops/plan/utilities/uuid/UUIDUtility.java index 2c117e5b8..00a2608d3 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/uuid/UUIDUtility.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/uuid/UUIDUtility.java @@ -8,10 +8,11 @@ package com.djrapitops.plan.utilities.uuid; import com.djrapitops.plan.api.exceptions.database.DBOpException; import com.djrapitops.plan.system.cache.DataCache; import com.djrapitops.plan.system.database.databases.Database; -import com.djrapitops.plugin.api.Check; import com.djrapitops.plugin.api.utility.UUIDFetcher; -import com.djrapitops.plugin.api.utility.log.Log; +import com.djrapitops.plugin.logging.L; +import com.djrapitops.plugin.logging.error.ErrorHandler; +import javax.inject.Inject; import java.util.UUID; /** @@ -19,11 +20,15 @@ import java.util.UUID; */ public class UUIDUtility { - /** - * Constructor used to hide the public constructor - */ - private UUIDUtility() { - throw new IllegalStateException("Utility class"); + private final DataCache dataCache; + private final Database database; + private final ErrorHandler errorHandler; + + @Inject + public UUIDUtility(DataCache dataCache, Database database, ErrorHandler errorHandler) { + this.dataCache = dataCache; + this.database = database; + this.errorHandler = errorHandler; } /** @@ -33,9 +38,9 @@ public class UUIDUtility { * @return UUID of the player. */ @Deprecated - public static UUID getUUIDOf(String playerName) { + public static UUID getUUIDOf_Old(String playerName) { try { - return getUUIDOf(playerName, Database.getActive()); + return Database.getActive().fetch().getUuidOf(playerName); } catch (Exception e) { return null; } @@ -45,21 +50,18 @@ public class UUIDUtility { * Get UUID of a player. * * @param playerName Player's name - * @param db Database to check from. * @return UUID of the player */ - private static UUID getUUIDOf(String playerName, Database db) { + public UUID getUUIDOf(String playerName) { UUID uuid = null; - if (Check.isBukkitAvailable()) { - UUID uuidOf = DataCache.getInstance().getUUIDof(playerName); - if (uuidOf != null) { - return uuidOf; - } + UUID uuidOf = dataCache.getUUIDof(playerName); + if (uuidOf != null) { + return uuidOf; } try { - uuid = db.fetch().getUuidOf(playerName); + uuid = database.fetch().getUuidOf(playerName); } catch (DBOpException e) { - Log.toLog(UUIDUtility.class, e); + errorHandler.log(L.ERROR, UUIDUtility.class, e); } try { if (uuid == null) {