UUIDUtility & PlanAPI initialized by Dagger - needs singleton

This commit is contained in:
Rsl1122 2018-08-21 18:33:40 +03:00
parent 6700d6918c
commit 81a6ed7365
15 changed files with 136 additions and 54 deletions

View File

@ -7,6 +7,7 @@ package com.djrapitops.plan;
import com.djrapitops.plan.api.exceptions.EnableException; import com.djrapitops.plan.api.exceptions.EnableException;
import com.djrapitops.plan.command.PlanBungeeCommand; import com.djrapitops.plan.command.PlanBungeeCommand;
import com.djrapitops.plan.modules.APFModule; import com.djrapitops.plan.modules.APFModule;
import com.djrapitops.plan.modules.bungee.BungeeAPIModule;
import com.djrapitops.plan.modules.bungee.BungeeConfigModule; import com.djrapitops.plan.modules.bungee.BungeeConfigModule;
import com.djrapitops.plan.modules.bungee.BungeeDatabaseModule; import com.djrapitops.plan.modules.bungee.BungeeDatabaseModule;
import com.djrapitops.plan.modules.common.*; import com.djrapitops.plan.modules.common.*;
@ -43,7 +44,8 @@ import java.io.InputStream;
BungeeDatabaseModule.class, BungeeDatabaseModule.class,
WebServerSystemModule.class, WebServerSystemModule.class,
ServerInfoSystemModule.class, ServerInfoSystemModule.class,
PluginHookModule.class PluginHookModule.class,
BungeeAPIModule.class
}) })
interface PlanBungeeComponent { interface PlanBungeeComponent {
@ -54,6 +56,7 @@ interface PlanBungeeComponent {
@Component.Builder @Component.Builder
interface Builder { interface Builder {
@Singleton
@BindsInstance @BindsInstance
Builder plan(PlanBungee plan); Builder plan(PlanBungee plan);

View File

@ -4,10 +4,15 @@
*/ */
package com.djrapitops.plan.api; package com.djrapitops.plan.api;
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.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.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; import java.util.UUID;
/** /**
@ -17,24 +22,37 @@ import java.util.UUID;
*/ */
public class BungeeAPI extends CommonAPI { 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) { @Inject
this.bungeeSystem = bungeeSystem; 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 @Override
public void addPluginDataSource(PluginData pluginData) { public void addPluginDataSource(PluginData pluginData) {
bungeeSystem.getHookHandler().addPluginDataSource(pluginData); hookHandler.addPluginDataSource(pluginData);
} }
@Override @Override
public String getPlayerName(UUID uuid) { public String getPlayerName(UUID uuid) {
return bungeeSystem.getCacheSystem().getDataCache().getName(uuid); return dataCache.getName(uuid);
} }
@Override @Override
public FetchOperations fetchFromPlanDB() { public FetchOperations fetchFromPlanDB() {
return bungeeSystem.getDatabaseSystem().getActiveDatabase().fetch(); return database.fetch();
} }
} }

View File

@ -6,7 +6,8 @@ package com.djrapitops.plan.api;
import com.djrapitops.plan.api.exceptions.database.DBOpException; import com.djrapitops.plan.api.exceptions.database.DBOpException;
import com.djrapitops.plan.utilities.uuid.UUIDUtility; 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.HashMap;
import java.util.Map; import java.util.Map;
@ -19,6 +20,14 @@ import java.util.UUID;
*/ */
public abstract class CommonAPI implements PlanAPI { 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 @Override
public String getPlayerInspectPageLink(UUID uuid) { public String getPlayerInspectPageLink(UUID uuid) {
return getPlayerInspectPageLink(getPlayerName(uuid)); return getPlayerInspectPageLink(getPlayerName(uuid));
@ -31,7 +40,7 @@ public abstract class CommonAPI implements PlanAPI {
@Override @Override
public UUID playerNameToUUID(String playerName) { public UUID playerNameToUUID(String playerName) {
return UUIDUtility.getUUIDOf(playerName); return uuidUtility.getUUIDOf(playerName);
} }
@Override @Override
@ -39,7 +48,7 @@ public abstract class CommonAPI implements PlanAPI {
try { try {
return fetchFromPlanDB().getPlayerNames(); return fetchFromPlanDB().getPlayerNames();
} catch (DBOpException e) { } catch (DBOpException e) {
Log.toLog(this.getClass(), e); errorHandler.log(L.ERROR, this.getClass(), e);
return new HashMap<>(); return new HashMap<>();
} }
} }

View File

@ -9,6 +9,8 @@ import com.djrapitops.plan.data.plugin.PluginData;
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.databases.Database;
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.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.UUID; import java.util.UUID;
@ -25,7 +27,14 @@ public class ServerAPI extends CommonAPI {
private final DataCache dataCache; private final DataCache dataCache;
@Inject @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.hookHandler = hookHandler;
this.activeDatabase = activeDatabase; this.activeDatabase = activeDatabase;
this.dataCache = dataCache; this.dataCache = dataCache;

View File

@ -33,16 +33,24 @@ public class InspectCommand extends CommandNode {
private final Locale locale; private final Locale locale;
private final Database database; private final Database database;
private final WebServer webServer; private final WebServer webServer;
private UUIDUtility uuidUtility;
private final ErrorHandler errorHandler; private final ErrorHandler errorHandler;
@Inject @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); super("inspect", Permissions.INSPECT.getPermission(), CommandType.PLAYER_OR_ARGS);
setArguments("<player>"); setArguments("<player>");
this.locale = locale; this.locale = locale;
this.database = database; this.database = database;
this.webServer = webServer; this.webServer = webServer;
this.uuidUtility = uuidUtility;
this.errorHandler = errorHandler; this.errorHandler = errorHandler;
setShortHelp(locale.getString(CmdHelpLang.INSPECT)); setShortHelp(locale.getString(CmdHelpLang.INSPECT));
@ -63,7 +71,7 @@ public class InspectCommand extends CommandNode {
private void runInspectTask(String playerName, ISender sender) { private void runInspectTask(String playerName, ISender sender) {
Processing.submitNonCritical(() -> { Processing.submitNonCritical(() -> {
try { try {
UUID uuid = UUIDUtility.getUUIDOf(playerName); UUID uuid = uuidUtility.getUUIDOf(playerName);
if (uuid == null) { if (uuid == null) {
sender.sendMessage(locale.getString(CommandLang.FAIL_USERNAME_NOT_VALID)); sender.sendMessage(locale.getString(CommandLang.FAIL_USERNAME_NOT_VALID));
return; return;

View File

@ -42,15 +42,22 @@ public class QInspectCommand extends CommandNode {
private final Locale locale; private final Locale locale;
private final Database database; private final Database database;
private UUIDUtility uuidUtility;
private final ErrorHandler errorHandler; private final ErrorHandler errorHandler;
@Inject @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); super("qinspect", Permissions.QUICK_INSPECT.getPermission(), CommandType.PLAYER_OR_ARGS);
setArguments("<player>"); setArguments("<player>");
this.locale = locale; this.locale = locale;
this.database = database; this.database = database;
this.uuidUtility = uuidUtility;
this.errorHandler = errorHandler; this.errorHandler = errorHandler;
setShortHelp(locale.getString(CmdHelpLang.QINSPECT)); setShortHelp(locale.getString(CmdHelpLang.QINSPECT));
@ -72,7 +79,7 @@ public class QInspectCommand extends CommandNode {
private void runInspectTask(String playerName, ISender sender) { private void runInspectTask(String playerName, ISender sender) {
Processing.submitNonCritical(() -> { Processing.submitNonCritical(() -> {
try { try {
UUID uuid = UUIDUtility.getUUIDOf(playerName); UUID uuid = uuidUtility.getUUIDOf(playerName);
if (uuid == null) { if (uuid == null) {
sender.sendMessage(locale.getString(CommandLang.FAIL_USERNAME_NOT_VALID)); sender.sendMessage(locale.getString(CommandLang.FAIL_USERNAME_NOT_VALID));
return; return;

View File

@ -32,14 +32,21 @@ public class ManageRemoveCommand extends CommandNode {
private final Locale locale; private final Locale locale;
private final Database database; private final Database database;
private UUIDUtility uuidUtility;
private final ErrorHandler errorHandler; private final ErrorHandler errorHandler;
@Inject @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); super("remove|delete", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS);
this.locale = locale; this.locale = locale;
this.database = database; this.database = database;
this.uuidUtility = uuidUtility;
this.errorHandler = errorHandler; this.errorHandler = errorHandler;
setArguments("<player>", "[-a]"); setArguments("<player>", "[-a]");
@ -65,7 +72,7 @@ public class ManageRemoveCommand extends CommandNode {
private void runRemoveTask(String playerName, ISender sender, String[] args) { private void runRemoveTask(String playerName, ISender sender, String[] args) {
Processing.submitCritical(() -> { Processing.submitCritical(() -> {
try { try {
UUID uuid = UUIDUtility.getUUIDOf(playerName); UUID uuid = uuidUtility.getUUIDOf(playerName);
if (uuid == null) { if (uuid == null) {
sender.sendMessage(locale.getString(CommandLang.FAIL_USERNAME_NOT_VALID)); sender.sendMessage(locale.getString(CommandLang.FAIL_USERNAME_NOT_VALID));

View File

@ -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;
}
}

View File

@ -2,9 +2,6 @@ package com.djrapitops.plan.modules.server;
import com.djrapitops.plan.api.PlanAPI; import com.djrapitops.plan.api.PlanAPI;
import com.djrapitops.plan.api.ServerAPI; 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.Module;
import dagger.Provides; import dagger.Provides;
@ -17,8 +14,8 @@ import dagger.Provides;
public class ServerAPIModule { public class ServerAPIModule {
@Provides @Provides
PlanAPI providePlanAPI(HookHandler hookHandler, DataCache dataCache, Database database) { PlanAPI providePlanAPI(ServerAPI serverAPI) {
return new ServerAPI(hookHandler, database, dataCache); return serverAPI;
} }
} }

View File

@ -9,7 +9,7 @@ import com.djrapitops.plan.ShutdownHook;
import com.djrapitops.plan.api.PlanAPI; import com.djrapitops.plan.api.PlanAPI;
import com.djrapitops.plan.api.exceptions.EnableException; import com.djrapitops.plan.api.exceptions.EnableException;
import com.djrapitops.plan.data.plugin.HookHandler; 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.export.ExportSystem;
import com.djrapitops.plan.system.file.FileSystem; import com.djrapitops.plan.system.file.FileSystem;
import com.djrapitops.plan.system.info.InfoSystem; import com.djrapitops.plan.system.info.InfoSystem;
@ -35,7 +35,7 @@ public class BukkitSystem extends PlanSystem implements ServerSystem {
ConfigSystem serverConfigSystem, ConfigSystem serverConfigSystem,
InfoSystem serverInfoSystem, InfoSystem serverInfoSystem,
BukkitServerInfo serverInfo, BukkitServerInfo serverInfo,
BukkitDBSystem bukkitDBSystem, DBSystem databaseSystem,
BukkitListenerSystem bukkitListenerSystem, BukkitListenerSystem bukkitListenerSystem,
BukkitTaskSystem bukkitTaskSystem, BukkitTaskSystem bukkitTaskSystem,
ExportSystem exportSystem, ExportSystem exportSystem,
@ -47,7 +47,7 @@ public class BukkitSystem extends PlanSystem implements ServerSystem {
this.fileSystem = fileSystem; this.fileSystem = fileSystem;
this.configSystem = serverConfigSystem; this.configSystem = serverConfigSystem;
this.exportSystem = exportSystem; this.exportSystem = exportSystem;
this.databaseSystem = bukkitDBSystem; this.databaseSystem = databaseSystem;
listenerSystem = bukkitListenerSystem; listenerSystem = bukkitListenerSystem;
taskSystem = bukkitTaskSystem; taskSystem = bukkitTaskSystem;

View File

@ -5,11 +5,10 @@
package com.djrapitops.plan.system; package com.djrapitops.plan.system;
import com.djrapitops.plan.PlanBungee; 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.api.exceptions.EnableException;
import com.djrapitops.plan.data.plugin.HookHandler; import com.djrapitops.plan.data.plugin.HookHandler;
import com.djrapitops.plan.system.cache.BungeeCacheSystem; 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.database.DBSystem;
import com.djrapitops.plan.system.export.ExportSystem; import com.djrapitops.plan.system.export.ExportSystem;
import com.djrapitops.plan.system.file.FileSystem; import com.djrapitops.plan.system.file.FileSystem;
@ -36,9 +35,10 @@ public class BungeeSystem extends PlanSystem {
FileSystem fileSystem, FileSystem fileSystem,
BungeeConfigSystem bungeeConfigSystem, BungeeConfigSystem bungeeConfigSystem,
BungeeCacheSystem bungeeCacheSystem, BungeeCacheSystem bungeeCacheSystem,
BungeeDBSystem bungeeDBSystem, DBSystem databaseSystem,
HookHandler hookHandler, HookHandler hookHandler,
ExportSystem exportSystem ExportSystem exportSystem,
PlanAPI planAPI
) { ) {
setTestSystem(this); setTestSystem(this);
@ -46,7 +46,7 @@ public class BungeeSystem extends PlanSystem {
this.fileSystem = fileSystem; this.fileSystem = fileSystem;
configSystem = bungeeConfigSystem; configSystem = bungeeConfigSystem;
this.exportSystem = exportSystem; this.exportSystem = exportSystem;
databaseSystem = bungeeDBSystem; this.databaseSystem = databaseSystem;
cacheSystem = bungeeCacheSystem; cacheSystem = bungeeCacheSystem;
listenerSystem = new BungeeListenerSystem(plugin); listenerSystem = new BungeeListenerSystem(plugin);
taskSystem = new BungeeTaskSystem(plugin.getRunnableFactory()); taskSystem = new BungeeTaskSystem(plugin.getRunnableFactory());
@ -55,7 +55,7 @@ public class BungeeSystem extends PlanSystem {
serverInfo = new BungeeServerInfo(plugin); serverInfo = new BungeeServerInfo(plugin);
this.hookHandler = hookHandler; this.hookHandler = hookHandler;
planAPI = new BungeeAPI(this); this.planAPI = planAPI;
} }
public static BungeeSystem getInstance() { public static BungeeSystem getInstance() {

View File

@ -69,6 +69,7 @@ public abstract class PlanSystem implements SubSystem {
localeSystem = new LocaleSystem(); localeSystem = new LocaleSystem();
} }
@Deprecated
public static PlanSystem getInstance() { public static PlanSystem getInstance() {
boolean bukkitAvailable = Check.isBukkitAvailable(); boolean bukkitAvailable = Check.isBukkitAvailable();
boolean bungeeAvailable = Check.isBungeeAvailable(); boolean bungeeAvailable = Check.isBungeeAvailable();

View File

@ -9,7 +9,7 @@ import com.djrapitops.plan.ShutdownHook;
import com.djrapitops.plan.api.PlanAPI; import com.djrapitops.plan.api.PlanAPI;
import com.djrapitops.plan.api.exceptions.EnableException; import com.djrapitops.plan.api.exceptions.EnableException;
import com.djrapitops.plan.data.plugin.HookHandler; 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.export.ExportSystem;
import com.djrapitops.plan.system.file.FileSystem; import com.djrapitops.plan.system.file.FileSystem;
import com.djrapitops.plan.system.info.InfoSystem; import com.djrapitops.plan.system.info.InfoSystem;
@ -38,7 +38,7 @@ public class SpongeSystem extends PlanSystem implements ServerSystem {
SpongeServerInfo serverInfo, SpongeServerInfo serverInfo,
SpongeListenerSystem spongeListenerSystem, SpongeListenerSystem spongeListenerSystem,
SpongeTaskSystem spongeTaskSystem, SpongeTaskSystem spongeTaskSystem,
SpongeDBSystem spongeDBSystem, DBSystem databaseSystem,
ExportSystem exportSystem, ExportSystem exportSystem,
HookHandler hookHandler, HookHandler hookHandler,
PlanAPI planAPI, PlanAPI planAPI,
@ -50,7 +50,7 @@ public class SpongeSystem extends PlanSystem implements ServerSystem {
this.fileSystem = fileSystem; this.fileSystem = fileSystem;
this.configSystem = serverConfigSystem; this.configSystem = serverConfigSystem;
this.exportSystem = exportSystem; this.exportSystem = exportSystem;
this.databaseSystem = spongeDBSystem; this.databaseSystem = databaseSystem;
listenerSystem = spongeListenerSystem; listenerSystem = spongeListenerSystem;
taskSystem = spongeTaskSystem; taskSystem = spongeTaskSystem;

View File

@ -39,7 +39,7 @@ public class PlayerPageHandler extends PageHandler {
} }
String playerName = target.get(0); String playerName = target.get(0);
UUID uuid = UUIDUtility.getUUIDOf(playerName); UUID uuid = UUIDUtility.getUUIDOf_Old(playerName);
Locale locale = request.getLocale(); Locale locale = request.getLocale();
boolean raw = target.size() >= 2 && target.get(1).equalsIgnoreCase("raw"); boolean raw = target.size() >= 2 && target.get(1).equalsIgnoreCase("raw");

View File

@ -8,10 +8,11 @@ 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.databases.Database;
import com.djrapitops.plugin.api.Check;
import com.djrapitops.plugin.api.utility.UUIDFetcher; 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; import java.util.UUID;
/** /**
@ -19,11 +20,15 @@ import java.util.UUID;
*/ */
public class UUIDUtility { public class UUIDUtility {
/** private final DataCache dataCache;
* Constructor used to hide the public constructor private final Database database;
*/ private final ErrorHandler errorHandler;
private UUIDUtility() {
throw new IllegalStateException("Utility class"); @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. * @return UUID of the player.
*/ */
@Deprecated @Deprecated
public static UUID getUUIDOf(String playerName) { public static UUID getUUIDOf_Old(String playerName) {
try { try {
return getUUIDOf(playerName, Database.getActive()); return Database.getActive().fetch().getUuidOf(playerName);
} catch (Exception e) { } catch (Exception e) {
return null; return null;
} }
@ -45,21 +50,18 @@ public class UUIDUtility {
* Get UUID of a player. * Get UUID of a player.
* *
* @param playerName Player's name * @param playerName Player's name
* @param db Database to check from.
* @return UUID of the player * @return UUID of the player
*/ */
private static UUID getUUIDOf(String playerName, Database db) { public UUID getUUIDOf(String playerName) {
UUID uuid = null; UUID uuid = null;
if (Check.isBukkitAvailable()) { UUID uuidOf = dataCache.getUUIDof(playerName);
UUID uuidOf = DataCache.getInstance().getUUIDof(playerName); if (uuidOf != null) {
if (uuidOf != null) { return uuidOf;
return uuidOf;
}
} }
try { try {
uuid = db.fetch().getUuidOf(playerName); uuid = database.fetch().getUuidOf(playerName);
} catch (DBOpException e) { } catch (DBOpException e) {
Log.toLog(UUIDUtility.class, e); errorHandler.log(L.ERROR, UUIDUtility.class, e);
} }
try { try {
if (uuid == null) { if (uuid == null) {