Example #1
0
  public boolean setupConnections() throws SQLException {
    if (!configuration.getLocalDb().isEnabled()) {
      getLogger().warning("Local Database is not enabled, disabling plugin");
      plugin.getPluginLoader().disablePlugin(this);
      return false;
    }

    localConn = setupConnection(configuration.getLocalDb());

    if (configuration.getConversionDb().isEnabled()) {
      conversionConn = setupConnection(configuration.getConversionDb());
    }

    if (configuration.getExternalDb().isEnabled()) {
      externalConn = setupConnection(configuration.getExternalDb());
    }

    return true;
  }
Example #2
0
  private void setupConversion() {
    getLogger().info("Running pre-conversion launch checks");
    ConvertDatabaseConfig conversionDb = configuration.getConversionDb();

    if (configuration.getLocalDb().getHost().equals(conversionDb.getHost())
        && configuration.getLocalDb().getName().equals(conversionDb.getName())) {
      if (!conversionChecks()) {
        return;
      }
    }

    // Begin the converting
    getLogger()
        .info("Conversion will begin shortly. You have 30 seconds to kill the process to abort.");
    try {
      Thread.sleep(30000L);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    getLogger().info("Launching conversion process");
    new UUIDConvert(conversionConn);
  }
Example #3
0
  private boolean conversionChecks() {
    ConvertDatabaseConfig conversionDb = configuration.getConversionDb();

    if (playerStorage
        .getTableInfo()
        .getTableName()
        .equals(conversionDb.getTableName("playerIpsTable"))) {
      getLogger().severe("players table equals playerIpsTable, aborting");
      return false;
    }

    if (playerBanStorage
        .getTableInfo()
        .getTableName()
        .equals(conversionDb.getTableName("bansTable"))) {
      getLogger().severe("playerBans table equals bansTable, aborting");
      return false;
    }

    if (playerBanRecordStorage
        .getTableInfo()
        .getTableName()
        .equals(conversionDb.getTableName("bansRecordTable"))) {
      getLogger().severe("playerBanRecords table equals bansRecordTable, aborting");
      return false;
    }

    if (playerMuteStorage
        .getTableInfo()
        .getTableName()
        .equals(conversionDb.getTableName("mutesTable"))) {
      getLogger().severe("playerMutes table equals mutesTable, aborting");
      return false;
    }

    if (playerMuteRecordStorage
        .getTableInfo()
        .getTableName()
        .equals(conversionDb.getTableName("mutesRecordTable"))) {
      getLogger().severe("playerMuteRecords table equals mutesRecordTable, aborting");
      return false;
    }

    if (playerKickStorage
        .getTableInfo()
        .getTableName()
        .equals(conversionDb.getTableName("kicksTable"))) {
      getLogger().severe("playerKicks table equals kicksTable, aborting");
      return false;
    }

    if (playerWarnStorage
        .getTableInfo()
        .getTableName()
        .equals(conversionDb.getTableName("warningsTable"))) {
      getLogger().severe("playerWarnings table equals warningsTable, aborting");
      return false;
    }

    if (ipBanStorage
        .getTableInfo()
        .getTableName()
        .equals(conversionDb.getTableName("ipBansTable"))) {
      getLogger().severe("ipBans table equals ipBansTable, aborting");
      return false;
    }

    if (ipBanRecordStorage
        .getTableInfo()
        .getTableName()
        .equals(conversionDb.getTableName("ipBansRecordTable"))) {
      getLogger().severe("ipBanRecords table equals ipBansRecordTable, aborting");
      return false;
    }

    return true;
  }