mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Oh! So that's why it's never used here
This commit is contained in:
parent
b3cf9bf839
commit
766f1f4127
@ -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");
|
||||
@ -29,15 +29,16 @@ public class DatabaseManagerFactory {
|
||||
/**
|
||||
* Sets the custom DatabaseManager class for mcMMO to use. This should be
|
||||
* called prior to mcMMO enabling.
|
||||
* <p>
|
||||
* <p/>
|
||||
* The provided class must have an empty constructor, which is the one
|
||||
* that will be used.
|
||||
* <p>
|
||||
* <p/>
|
||||
* This method is intended for API use, but it should not be considered
|
||||
* stable. This method is subject to change and/or removal in future
|
||||
* versions.
|
||||
*
|
||||
* @param clazz the DatabaseManager class to use
|
||||
*
|
||||
* @throws IllegalArgumentException if the provided class does not have
|
||||
* an empty constructor
|
||||
*/
|
||||
@ -63,13 +64,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<? extends DatabaseManager> clazz) throws Throwable {
|
||||
return customManager.getConstructor((Class<?>) clazz).newInstance((Object[]) null);
|
||||
return clazz.getConstructor((Class<?>) null).newInstance((Object[]) null);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user