Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.03 KB | None | 0 0
  1. public void hasRecordAsync(final CallBack<HashMap> callBack, final Player player) {
  2.         Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
  3.             @Override
  4.             public void run() {
  5.                 final HashMap<String, Boolean> result = new HashMap<String, Boolean>();
  6.      
  7.                 PreparedStatement q = connection.prepareStatement("SELECT * FROM " + tableName + " WHERE " + rowUsername + " = ? LIMIT 1");
  8.                
  9.                 q.setString(1, player.getName());
  10.                
  11.                 ResultSet resultat = q.executeQuery();
  12.                 boolean hasRecord = resultat.next();
  13.                 q.close();
  14.      
  15.                 result.put("hasRecord", hasRecord);
  16.      
  17.                 Bukkit.getScheduler().runTask(plugin, new Runnable() {
  18.                         @Override
  19.                         public void run() {
  20.                             callBack.onSuccess(result);
  21.                         }
  22.                
  23.                 });
  24.             }
  25.         });
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement