mirror of
https://github.com/lucko/LuckPerms.git
synced 2025-09-03 19:32:34 +02:00
Fix username lookup returning "null" instead of null (#3220)
This commit is contained in:
@@ -573,7 +573,10 @@ public class MongoStorage implements StorageImplementation {
|
|||||||
MongoCollection<Document> c = this.database.getCollection(this.prefix + "uuid");
|
MongoCollection<Document> c = this.database.getCollection(this.prefix + "uuid");
|
||||||
Document doc = c.find(new Document("_id", uniqueId)).first();
|
Document doc = c.find(new Document("_id", uniqueId)).first();
|
||||||
if (doc != null) {
|
if (doc != null) {
|
||||||
return doc.get("name", String.class);
|
String username = doc.get("name", String.class);
|
||||||
|
if (username != null && !username.equals("null")) {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@@ -694,7 +694,10 @@ public class SqlStorage implements StorageImplementation {
|
|||||||
ps.setString(1, uniqueId.toString());
|
ps.setString(1, uniqueId.toString());
|
||||||
try (ResultSet rs = ps.executeQuery()) {
|
try (ResultSet rs = ps.executeQuery()) {
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
return rs.getString("username");
|
String username = rs.getString("username");
|
||||||
|
if (username != null && !username.equals("null")) {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user