I'm trying to return a boolean inside a Method and i'm using a consumer function. Is there any way to return that value directly inside that Consumer expression?
Here's the Code:
private static boolean uuidExists(UUID uuid) {
MySQL.getResult("", rs -> {
try {
if(rs.next()){
return rs.getString("UUID") != null;
}
} catch (SQLException e) {
}
});
return false;
}
EDIT:
I know that i could create a boolean and change that value but i do not wanna do that.
EDIT:
getResult code:
public static void getResult(String qry, Consumer<ResultSet> consumer){
new BukkitRunnable() {
@Override
public void run() {
if(isConnected()) {
consumer.accept(Warpixel.getWarpixel().getStats().getResult(qry));
return;
}
consumer.accept(null);
}
}.runTaskAsynchronously(Bedwars.getMain());
}