public void setup(Plugin p, boolean b) {
    enabled = b;
    if (b) {
      try {
        PreparedStatement s =
            dbman.createStatement(
                " CREATE TABLE "
                    + SettingsManager.getSqlPrefix()
                    + "playerstats(id int NOT NULL AUTO_INCREMENT PRIMARY KEY, gameno int,arenaid int, player text, points int,position int,"
                    + " kills int, death int, killed text,time int, ks1 int, ks2 int,ks3 int, ks4 int, ks5 int)");

        PreparedStatement s1 =
            dbman.createStatement(
                " CREATE TABLE "
                    + SettingsManager.getSqlPrefix()
                    + "gamestats(gameno int NOT NULL AUTO_INCREMENT PRIMARY KEY, arenaid int, players int, winner text, time int )");

        DatabaseMetaData dbm = dbman.getMysqlConnection().getMetaData();
        ResultSet tables =
            dbm.getTables(null, null, SettingsManager.getSqlPrefix() + "playerstats", null);
        ResultSet tables1 =
            dbm.getTables(null, null, SettingsManager.getSqlPrefix() + "gamestats", null);

        if (tables.next()) {
        } else {
          s.execute();
        }
        if (tables1.next()) {
        } else {
          s1.execute();
        }
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }
  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));
 }