Example #1
0
 public static void loadChamps() {
   for (int i = 1; i <= GodManager.getActiveGods(); i++) {
     GodType t = Utility.getGodTypeFromDBNumber(i);
     ResultSet r = null;
     try {
       r =
           (new SQLQuery(
                   new String("select lastActivated,champ from £.gods where idGod=" + i + ";"),
                   msqlc))
               .excecuteQuery();
     } catch (MySQLSyntaxErrorException e1) {
       e1.printStackTrace();
     }
     try {
       while (r.next()) {
         GregorianCalendar c = null;
         Date d = r.getDate(1);
         if (d != null) {
           c = new GregorianCalendar();
           c.setTime(r.getDate(1));
         }
         God g = GodManager.getGod(t);
         if (g != null) {
           g.setLastActivated(c);
           String s = r.getString(2);
           if (s != null) {
             OfflinePlayer p = Bukkit.getOfflinePlayer(r.getString(2));
             g.setChamp(p);
           }
         }
       }
     } catch (SQLException e) {
       e.printStackTrace();
     }
   }
 }