Beispiel #1
0
 public void addWinnerPoint(final String player) {
   if (this.hasPlayer(player)) {
     HEventos.getHEventos().getMysql().updateWins(player, 1);
   } else {
     HEventos.getHEventos().getMysql().addNew(player, 1, 1);
   }
 }
Beispiel #2
0
 public void getTOPParticipations(final Player p) {
   try {
     p.sendMessage(HEventos.getHEventos().getConfigUtil().getTopParticipacoes());
     Class.forName("org.sqlite.JDBC");
     final String sql = "SELECT * FROM eventos ORDER BY participations DESC LIMIT 10";
     final ResultSet rs = this.stmt.executeQuery(sql);
     int i = 0;
     while (rs.next()) {
       i++;
       p.sendMessage(
           HEventos.getHEventos()
               .getConfigUtil()
               .getTopParticipacoesPosicao()
               .replace("$posicao$", i + "")
               .replace("$player$", rs.getString("player"))
               .replace("$participacoes$", rs.getInt("wins") + ""));
     }
   } catch (final Exception e) {
     e.printStackTrace();
   }
 }
Beispiel #3
0
 public SQLite() {
   try {
     Class.forName("org.sqlite.JDBC");
     this.connection =
         DriverManager.getConnection(
             "jdbc:sqlite:"
                 + HEventos.getHEventos().getDataFolder().getAbsolutePath()
                 + File.separator
                 + "database.db");
     this.stmt = this.connection.createStatement();
     this.stmt.execute(
         "CREATE TABLE IF NOT EXISTS eventos (player VARCHAR(255), wins INTEGER, participations INTEGER)");
   } catch (final SQLException e) {
     e.printStackTrace();
   } catch (final ClassNotFoundException e) {
     e.printStackTrace();
   }
 }