Advertisement
Guest User

Stat Script v1.0

a guest
Nov 5th, 2015
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.94 KB | None | 0 0
  1.         URL statpg = new URL("http://stats.aloha.pk:1337/");
  2.         BufferedReader htmlcrawler = new BufferedReader(new InputStreamReader(statpg.openStream()));
  3.         String username = comm[comm.length - 1];
  4.         String ln, name = "", kill = "", death = "", ratio = "", caps = "", place = "";
  5.         while((ln = htmlcrawler.readLine()) != null) {
  6.             if(ln.toLowerCase().contains(username)) {
  7.                 name = "Username: " + DARK_GRAY + ln.trim().substring(ln.indexOf("\">") - 2).replaceAll("</a></td>", "") + NORMAL;
  8.                 ln = htmlcrawler.readLine();
  9.                 kill = DARK_GREEN + BOLD + " / " + NORMAL + "Kills: " + GREEN + ln.trim().replaceAll("<td>", "").replaceAll("</td>", "") + NORMAL;
  10.                 ln = htmlcrawler.readLine();
  11.                 death = DARK_GREEN + BOLD + " / " + NORMAL + "Deaths: " + RED + ln.trim().replaceAll("<td>", "").replaceAll("</td>", "") + NORMAL;
  12.                 ln = htmlcrawler.readLine();
  13.                 ratio = DARK_GREEN + BOLD + " / " + NORMAL + "Ratio: ";
  14.                 if(Double.parseDouble(ln.trim().replaceAll("<td>", "").replaceAll("</td>", "")) <= 1.0) {
  15.                     ratio += + DARK_BLUE + ln.trim().replaceAll("<td>", "").replaceAll("</td>", "") + NORMAL;
  16.                 }
  17.                 else if(Double.parseDouble(ln.trim().replaceAll("<td>", "").replaceAll("</td>", "")) > 1.0 || Double.parseDouble(ln.trim().replaceAll("<td>", "").replaceAll("</td>", "")) <= 2.0) {
  18.                     ratio += BLUE + ln.trim().replaceAll("<td>", "").replaceAll("</td>", "") + NORMAL;
  19.                 }
  20.                 else if(Double.parseDouble(ln.trim().replaceAll("<td>", "").replaceAll("</td>", "")) > 2.0 || Double.parseDouble(ln.trim().replaceAll("<td>", "").replaceAll("</td>", "")) <= 3.5) {
  21.                     ratio += GREEN + ln.trim().replaceAll("<td>", "").replaceAll("</td>", "") + NORMAL;
  22.                 }
  23.                 else if(Double.parseDouble(ln.trim().replaceAll("<td>", "").replaceAll("</td>", "")) > 3.5) {
  24.                     ratio += DARK_GREEN + ln.trim().replaceAll("<td>", "").replaceAll("</td>", "") + NORMAL;
  25.                 }
  26.                 ln = htmlcrawler.readLine();
  27.                 caps = DARK_GREEN + BOLD + " / " + NORMAL + "Intel Caps: " + MAGENTA + ln.trim().replaceAll("<td>", "").replaceAll("</td>", "") + NORMAL;
  28.                 htmlcrawler.readLine(); htmlcrawler.readLine(); htmlcrawler.readLine();
  29.                 ln = htmlcrawler.readLine();
  30.                 place = DARK_GREEN + BOLD + " / " + NORMAL + "Place: " + DARK_BLUE + (Integer.parseInt(ln.trim().replaceAll("<td>", "").replaceAll("</td>", "")) - 1);
  31.                 if(place.endsWith("1")) {
  32.                     if(place.substring(place.length() - 2).equals("11")) {
  33.                         place += "th" + NORMAL;
  34.                     }
  35.                     else {
  36.                         place += "st" + NORMAL;
  37.                     }
  38.                 }
  39.                 else if(place.endsWith("2")) {
  40.                     if(place.substring(place.length() - 2).equals("12")) {
  41.                         place += "th" + NORMAL;
  42.                     }
  43.                     else {
  44.                         place += "nd" + NORMAL;
  45.                     }
  46.                 }
  47.                 else if(place.endsWith("3")) {
  48.                    if(place.substring(place.length() - 2).equals("13")) {
  49.                         place += "th" + NORMAL;
  50.                     }
  51.                     else {
  52.                         place += "rd" + NORMAL;
  53.                     }
  54.                 }
  55.                 else {
  56.                     place += "th" + NORMAL;
  57.                 }
  58.                 htmlcrawler.close();
  59.                 msg("", chan, name + place + kill + death + ratio + caps, writer);
  60.                 break;
  61.             }
  62.         }
  63.         boolean check = name.equals("");
  64.         if (check) {
  65.             msg(user, chan, RED + "That username was not found." + NORMAL, writer);
  66.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement