public void saveGame(int arenaid, Player winner, int players, long time) {
    if (!enabled) return;
    int gameno = 0;
    Game g = GameManager.getInstance().getGame(arenaid);

    try {
      long time1 = new Date().getTime();
      PreparedStatement s2 =
          dbman.createStatement(
              "SELECT * FROM "
                  + SettingsManager.getSqlPrefix()
                  + "gamestats ORDER BY gameno DESC LIMIT 1");
      ResultSet rs = s2.executeQuery();
      rs.next();
      gameno = rs.getInt(1) + 1;

      if (time1 + 5000 < new Date().getTime())
        System.out.println(
            "Your database took a long time to respond. Check the connection between the server and database");
    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      g.setRBStatus("Error: getno");
    }

    addSQL(
        "INSERT INTO "
            + SettingsManager.getSqlPrefix()
            + "gamestats VALUES(NULL,"
            + arenaid
            + ","
            + players
            + ",'"
            + winner.getName()
            + "',"
            + time
            + ")");

    for (PlayerStatsSession s : arenas.get(arenaid).values()) {
      s.setGameID(gameno);
      addSQL(s.createQuery());
    }
    arenas.get(arenaid).clear();
  }
 private void addSQL(String query) {
   addSQL(dbman.createStatement(query));
 }