public CharacterService(NGECore core) {

    this.core = core;
    this.databaseConnection = core.getDatabase1();
    this.databaseConnection2 = core.getDatabase2();
    try {
      nameGenerator = new engine.resources.common.NameGen("names.txt");
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
Example #2
0
  public String getAccountNameFromDB(long id) {
    String accountName = null;
    PreparedStatement preparedStatement;

    try {
      preparedStatement =
          core.getDatabase1().preparedStatement("SELECT user FROM accounts WHERE id=" + id);
      ResultSet resultSet = preparedStatement.executeQuery();
      if (resultSet.next()) accountName = resultSet.getString("user");
    } catch (SQLException e) {
      e.printStackTrace();
    }

    return accountName;
  }