forked from Fascinated/Bat
maybe fix a NPE??
This commit is contained in:
parent
048d2856f9
commit
35596b720b
@ -53,6 +53,11 @@ public class BatUser extends ProfileHolder {
|
|||||||
*/
|
*/
|
||||||
private Date createdAt;
|
private Date createdAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The discord user associated with this user
|
||||||
|
*/
|
||||||
|
private User user;
|
||||||
|
|
||||||
public BatUser(@NonNull String id, @NonNull org.bson.Document document) {
|
public BatUser(@NonNull String id, @NonNull org.bson.Document document) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.document = document;
|
this.document = document;
|
||||||
@ -61,6 +66,7 @@ public class BatUser extends ProfileHolder {
|
|||||||
|
|
||||||
User user = DiscordService.JDA.getUserById(id);
|
User user = DiscordService.JDA.getUserById(id);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
|
this.user = user;
|
||||||
this.globalName = user.getGlobalName();
|
this.globalName = user.getGlobalName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,7 +84,10 @@ public class BatUser extends ProfileHolder {
|
|||||||
* @return the guild
|
* @return the guild
|
||||||
*/
|
*/
|
||||||
public User getDiscordUser() {
|
public User getDiscordUser() {
|
||||||
return DiscordService.JDA.getUserById(id);
|
if (user == null) {
|
||||||
|
user = DiscordService.JDA.getUserById(id);
|
||||||
|
}
|
||||||
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user