MaxlHD

KD

Sep 1st, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. public int getKills(String uuid) {
  2. int kills = 0;
  3. if(exists(uuid)){
  4. ResultSet rs = main.mysql.query("SELECT * FROM kbffa_stats WHERE uuid='"+uuid+"'");
  5. try {
  6. if(rs.next() || (Integer.valueOf(rs.getInt("kills"))) != null){
  7. kills = rs.getInt("kills");
  8. }
  9. } catch (SQLException e) {
  10. e.printStackTrace();
  11. }
  12. }
  13. return kills;
  14. }
  15.  
  16. public int getDeaths(String uuid) {
  17. int deaths = 0;
  18. if(exists(uuid)){
  19. ResultSet rs = main.mysql.query("SELECT * FROM kbffa_stats WHERE uuid='"+uuid+"'");
  20. try {
  21. if(rs.next() || (Integer.valueOf(rs.getInt("deaths"))) != null){
  22. deaths = rs.getInt("deaths");
  23. }
  24. } catch (SQLException e) {
  25. e.printStackTrace();
  26. }
  27. }
  28. return deaths;
  29. }
  30.  
  31. public double getKD(String uuid) {
  32.  
  33. double kd = 0;
  34.  
  35. kd = (double)getKills(uuid)/(double)getDeaths(uuid);
  36.  
  37. return kd;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment