use of com.skelril.skree.service.internal.database.DatabaseServiceImpl in project Skree by Skelril.
the class DatabaseSystem method init.
@NModuleTrigger(trigger = "PRE_INITIALIZATION")
public void init() {
try {
Class.forName("org.mariadb.jdbc.Driver").newInstance();
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
e.printStackTrace();
}
try {
DatabaseConfig config = ConfigLoader.loadConfig("database.json", DatabaseConfig.class);
String database = config.getDatabase();
String username = config.getUsername();
String password = config.getPassword();
setupHandle(database, username, password);
runMigrations(database, username, password);
} catch (IOException e) {
e.printStackTrace();
}
service = new DatabaseServiceImpl();
Sponge.getEventManager().registerListeners(SkreePlugin.inst(), service);
Sponge.getServiceManager().setProvider(SkreePlugin.inst(), DatabaseService.class, service);
}
Aggregations