From 7a95b7a8d997b382ab549690d0361734f62b45b7 Mon Sep 17 00:00:00 2001 From: riking Date: Tue, 8 Oct 2013 20:47:20 -0700 Subject: [PATCH] Oh! So that's why it's never used here --- .../database/DatabaseManagerFactory.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/database/DatabaseManagerFactory.java b/src/main/java/com/gmail/nossr50/database/DatabaseManagerFactory.java index 87f964f46..72bf1e109 100644 --- a/src/main/java/com/gmail/nossr50/database/DatabaseManagerFactory.java +++ b/src/main/java/com/gmail/nossr50/database/DatabaseManagerFactory.java @@ -10,7 +10,7 @@ public class DatabaseManagerFactory { public static DatabaseManager getDatabaseManager() { if (customManager != null) { try { - return createCustomDatabaseManager(customManager); + return createDefaultCustomDatabaseManager(); } catch (Exception e) { mcMMO.p.debug("Could not create custom database manager"); @@ -63,13 +63,24 @@ public class DatabaseManagerFactory { case SQL: return new SQLDatabaseManager(); + case CUSTOM: + try { + return createDefaultCustomDatabaseManager(); + } catch (Throwable e) { + e.printStackTrace(); + + } + default: 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 clazz) throws Throwable { - return customManager.getConstructor((Class) clazz).newInstance((Object[]) null); + return clazz.getConstructor((Class) null).newInstance((Object[]) null); } }