Oh! So that's why it's never used here

This commit is contained in:
riking 2013-10-08 20:47:20 -07:00
parent b3cf9bf839
commit 7a95b7a8d9

View File

@ -10,7 +10,7 @@ public class DatabaseManagerFactory {
public static DatabaseManager getDatabaseManager() { public static DatabaseManager getDatabaseManager() {
if (customManager != null) { if (customManager != null) {
try { try {
return createCustomDatabaseManager(customManager); return createDefaultCustomDatabaseManager();
} }
catch (Exception e) { catch (Exception e) {
mcMMO.p.debug("Could not create custom database manager"); mcMMO.p.debug("Could not create custom database manager");
@ -63,13 +63,24 @@ public class DatabaseManagerFactory {
case SQL: case SQL:
return new SQLDatabaseManager(); return new SQLDatabaseManager();
case CUSTOM:
try {
return createDefaultCustomDatabaseManager();
} catch (Throwable e) {
e.printStackTrace();
}
default: default:
return null; return null;
} }
} }
//TODO: Why is clazz never used here? public static DatabaseManager createDefaultCustomDatabaseManager() throws Throwable {
return customManager.getConstructor((Class<?>) null).newInstance((Object[]) null);
}
public static DatabaseManager createCustomDatabaseManager(Class<? extends DatabaseManager> clazz) throws Throwable { public static DatabaseManager createCustomDatabaseManager(Class<? extends DatabaseManager> clazz) throws Throwable {
return customManager.getConstructor((Class<?>) clazz).newInstance((Object[]) null); return clazz.getConstructor((Class<?>) null).newInstance((Object[]) null);
} }
} }