Guest User

Untitled

a guest
Aug 23rd, 2019
77
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static void updateKill(Player player, int kills, int deaths, boolean remove) {
  2. int kill = getKills(player);
  3. kills += kill;
  4. if (isUserExists(player)) {
  5. try {
  6. PreparedStatement ps = MySQL.getConnection()
  7. .prepareStatement("UPDATE creepergames SET Kills = (Kills+1) WHERE Name = ?");
  8. ps.setString(1, player.getName());
  9.  
  10. ps.executeUpdate();
  11. } catch (SQLException e) {
  12. // TODO Auto-generated catch block
  13. e.printStackTrace();
  14. }
  15. } else {
  16. try {
  17. PreparedStatement ps = MySQL.getConnection()
  18. .prepareStatement("INSERT INTO creepergames (Name,Kills,Deaths) VALUES (?,?,?)");
  19. ps.setString(1, player.getName());
  20. ps.setInt(2, kills);
  21. ps.setInt(3, deaths);
  22. ps.executeUpdate();
  23. } catch (SQLException e) {
  24. // TODO Auto-generated catch block
  25. e.printStackTrace();
  26. }
  27. }
  28.  
  29. }
RAW Paste Data