Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- URL statpg = new URL("http://stats.aloha.pk:1337/");
- BufferedReader htmlcrawler = new BufferedReader(new InputStreamReader(statpg.openStream()));
- String username = comm[comm.length - 1];
- String ln, name = "", kill = "", death = "", ratio = "", caps = "", place = "";
- while((ln = htmlcrawler.readLine()) != null) {
- if(ln.toLowerCase().contains(username)) {
- name = "Username: " + DARK_GRAY + ln.trim().substring(ln.indexOf("\">") - 2).replaceAll("</a></td>", "") + NORMAL;
- ln = htmlcrawler.readLine();
- kill = DARK_GREEN + BOLD + " / " + NORMAL + "Kills: " + GREEN + ln.trim().replaceAll("<td>", "").replaceAll("</td>", "") + NORMAL;
- ln = htmlcrawler.readLine();
- death = DARK_GREEN + BOLD + " / " + NORMAL + "Deaths: " + RED + ln.trim().replaceAll("<td>", "").replaceAll("</td>", "") + NORMAL;
- ln = htmlcrawler.readLine();
- ratio = DARK_GREEN + BOLD + " / " + NORMAL + "Ratio: ";
- if(Double.parseDouble(ln.trim().replaceAll("<td>", "").replaceAll("</td>", "")) <= 1.0) {
- ratio += + DARK_BLUE + ln.trim().replaceAll("<td>", "").replaceAll("</td>", "") + NORMAL;
- }
- else if(Double.parseDouble(ln.trim().replaceAll("<td>", "").replaceAll("</td>", "")) > 1.0 || Double.parseDouble(ln.trim().replaceAll("<td>", "").replaceAll("</td>", "")) <= 2.0) {
- ratio += BLUE + ln.trim().replaceAll("<td>", "").replaceAll("</td>", "") + NORMAL;
- }
- else if(Double.parseDouble(ln.trim().replaceAll("<td>", "").replaceAll("</td>", "")) > 2.0 || Double.parseDouble(ln.trim().replaceAll("<td>", "").replaceAll("</td>", "")) <= 3.5) {
- ratio += GREEN + ln.trim().replaceAll("<td>", "").replaceAll("</td>", "") + NORMAL;
- }
- else if(Double.parseDouble(ln.trim().replaceAll("<td>", "").replaceAll("</td>", "")) > 3.5) {
- ratio += DARK_GREEN + ln.trim().replaceAll("<td>", "").replaceAll("</td>", "") + NORMAL;
- }
- ln = htmlcrawler.readLine();
- caps = DARK_GREEN + BOLD + " / " + NORMAL + "Intel Caps: " + MAGENTA + ln.trim().replaceAll("<td>", "").replaceAll("</td>", "") + NORMAL;
- htmlcrawler.readLine(); htmlcrawler.readLine(); htmlcrawler.readLine();
- ln = htmlcrawler.readLine();
- place = DARK_GREEN + BOLD + " / " + NORMAL + "Place: " + DARK_BLUE + (Integer.parseInt(ln.trim().replaceAll("<td>", "").replaceAll("</td>", "")) - 1);
- if(place.endsWith("1")) {
- if(place.substring(place.length() - 2).equals("11")) {
- place += "th" + NORMAL;
- }
- else {
- place += "st" + NORMAL;
- }
- }
- else if(place.endsWith("2")) {
- if(place.substring(place.length() - 2).equals("12")) {
- place += "th" + NORMAL;
- }
- else {
- place += "nd" + NORMAL;
- }
- }
- else if(place.endsWith("3")) {
- if(place.substring(place.length() - 2).equals("13")) {
- place += "th" + NORMAL;
- }
- else {
- place += "rd" + NORMAL;
- }
- }
- else {
- place += "th" + NORMAL;
- }
- htmlcrawler.close();
- msg("", chan, name + place + kill + death + ratio + caps, writer);
- break;
- }
- }
- boolean check = name.equals("");
- if (check) {
- msg(user, chan, RED + "That username was not found." + NORMAL, writer);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement