Java Code Examples for org.spongepowered.api.service.sql.SqlService

The following examples show how to use org.spongepowered.api.service.sql.SqlService. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public void init()
    this.sql = Sponge.getServiceManager().provideUnchecked(SqlService.class);
    try // TODO: the logger is annoying, so disable it anyway (although it is a dirty way)
        Field field = DB.class.getDeclaredField("LOGGER");

        Field modifiersField = Field.class.getDeclaredField("modifiers");
        int m = field.getModifiers() & ~Modifier.FINAL;
        modifiersField.setInt(field, m);

        NOPLogger l = NOPLogger.NOP_LOGGER;
        field.set(null, l);
    catch (ReflectiveOperationException e)
        throw new IllegalStateException(e);
Example 2
Source Project: FlexibleLogin   Source File:    License: MIT License 5 votes vote down vote up
public Database(Logger logger, Settings settings, String tableName) throws SQLException {
    this.logger = logger;
    this.tableName = tableName;

    SQLConfig sqlConfig = settings.getGeneral().getSQL();
    Path configDir = settings.getConfigDir();
    this.storageType = sqlConfig.getType();

    String jdbcConnection = buildJDBCUrl(sqlConfig, configDir);
    this.dataSource = Sponge.getServiceManager().provideUnchecked(SqlService.class).getDataSource(jdbcConnection);
Example 3
Source Project: PlotMe-Core   Source File:    License: GNU General Public License v3.0 4 votes vote down vote up
public void onInit(PreInitializationEvent event) {
    sql = services.potentiallyProvide(SqlService.class);