Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. public void getMutes()
  2. {
  3. new BukkitRunnable()
  4. {
  5. @Override
  6. public void run()
  7. {
  8. Connection connection = MySQL.getConnection();
  9. PreparedStatement preparedStatement = null;
  10. ResultSet rs = null;
  11.  
  12. try
  13. {
  14. preparedStatement = connection.prepareStatement("SELECT * FROM `punishments` WHERE `id` = ? AND `type` = ? ORDER BY `start` DESC LIMIT 1;");
  15. preparedStatement.setString(1, uuid.toString());
  16. preparedStatement.setString(2, PunishmentType.MUTE.toString());
  17. preparedStatement.executeQuery();
  18. rs = preparedStatement.getResultSet();
  19. if(rs.isBeforeFirst())
  20. {
  21. while (rs.next())
  22. {
  23. mute = rs.getLong("end");
  24. }
  25. }
  26.  
  27. } catch (SQLException e)
  28. {
  29. e.printStackTrace();
  30. }
  31. finally
  32. {
  33. try
  34. {
  35. assert rs != null;
  36. rs.close();
  37. preparedStatement.close();
  38. } catch (SQLException e)
  39. {
  40. e.printStackTrace();
  41. }
  42. }
  43. }
  44. }.runTaskAsynchronously(core);
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement