maybe fix some NPEs when calling events

This commit is contained in:
Lee
2024-07-04 03:33:06 +01:00
parent c98d8d7e26
commit 3b3ea2b3cc
3 changed files with 44 additions and 33 deletions

View File

@ -78,7 +78,7 @@ public class EventService extends ListenerAdapter {
return;
}
BatGuild guild = guildService.getGuild(event.getGuild().getId());
BatUser user = userService.getUser(event.getUser().getId());
BatUser user = userService.getUser(event.getUser().getId(), event.getUser());
for (EventListener listener : LISTENERS) {
listener.onGuildMemberJoin(guild, user, event);
@ -91,7 +91,7 @@ public class EventService extends ListenerAdapter {
return;
}
BatGuild guild = guildService.getGuild(event.getGuild().getId());
BatUser user = userService.getUser(event.getUser().getId());
BatUser user = userService.getUser(event.getUser().getId(), event.getUser());
for (EventListener listener : LISTENERS) {
listener.onGuildMemberLeave(guild, user, event);
@ -104,7 +104,7 @@ public class EventService extends ListenerAdapter {
return;
}
BatGuild guild = guildService.getGuild(event.getGuild().getId());
BatUser user = userService.getUser(event.getAuthor().getId());
BatUser user = userService.getUser(event.getAuthor().getId(), event.getAuthor());
for (EventListener listener : LISTENERS) {
listener.onGuildMessageReceive(guild, user, event);
@ -128,7 +128,7 @@ public class EventService extends ListenerAdapter {
return;
}
BatGuild guild = event.getGuild() != null ? guildService.getGuild(event.getGuild().getId()) : null;
BatUser user = userService.getUser(event.getUser().getId());
BatUser user = userService.getUser(event.getUser().getId(), event.getUser());
for (EventListener listener : LISTENERS) {
listener.onStringSelectInteraction(guild, user, event);
@ -141,7 +141,7 @@ public class EventService extends ListenerAdapter {
return;
}
BatGuild guild = event.getGuild() != null ? guildService.getGuild(event.getGuild().getId()) : null;
BatUser user = userService.getUser(event.getUser().getId());
BatUser user = userService.getUser(event.getUser().getId(), event.getUser());
try {
for (EventListener listener : LISTENERS) {
@ -159,7 +159,7 @@ public class EventService extends ListenerAdapter {
return;
}
BatGuild guild = event.getGuild() != null ? guildService.getGuild(event.getGuild().getId()) : null;
BatUser user = userService.getUser(event.getUser().getId());
BatUser user = userService.getUser(event.getUser().getId(), event.getUser());
try {
for (EventListener listener : LISTENERS) {
@ -176,7 +176,7 @@ public class EventService extends ListenerAdapter {
if (event.getUser().isBot()) {
return;
}
BatUser user = userService.getUser(event.getUser().getId());
BatUser user = userService.getUser(event.getUser().getId(), event.getUser());
for (EventListener listener : LISTENERS) {
listener.onUserUpdateGlobalName(user, event.getOldGlobalName(), event.getNewGlobalName(), event);
@ -189,7 +189,7 @@ public class EventService extends ListenerAdapter {
return;
}
BatGuild guild = guildService.getGuild(event.getGuild().getId());
BatUser user = userService.getUser(event.getUser().getId());
BatUser user = userService.getUser(event.getUser().getId(), event.getUser());
for (EventListener listener : LISTENERS) {
listener.onGuildMemberUpdateNickname(guild, user, event.getOldNickname(), event.getNewNickname(), event);
@ -202,7 +202,7 @@ public class EventService extends ListenerAdapter {
return;
}
BatGuild guild = guildService.getGuild(event.getGuild().getId());
BatUser user = userService.getUser(event.getUser().getId());
BatUser user = userService.getUser(event.getUser().getId(), event.getUser());
for (EventListener listener : LISTENERS) {
listener.onGuildMemberRoleAdd(guild, user, event.getRoles(), event);
@ -215,7 +215,7 @@ public class EventService extends ListenerAdapter {
return;
}
BatGuild guild = guildService.getGuild(event.getGuild().getId());
BatUser user = userService.getUser(event.getUser().getId());
BatUser user = userService.getUser(event.getUser().getId(), event.getUser());
for (EventListener listener : LISTENERS) {
listener.onGuildMemberRoleRemove(guild, user, event.getRoles(), event);
@ -246,7 +246,7 @@ public class EventService extends ListenerAdapter {
return;
}
BatGuild guild = guildService.getGuild(event.getGuild().getId());
BatUser user = userService.getUser(event.getUser().getId());
BatUser user = userService.getUser(event.getUser().getId(), event.getUser());
for (EventListener listener : LISTENERS) {
listener.onGuildMemberBan(guild, user, event);
@ -259,7 +259,7 @@ public class EventService extends ListenerAdapter {
return;
}
BatGuild guild = guildService.getGuild(event.getGuild().getId());
BatUser user = userService.getUser(event.getUser().getId());
BatUser user = userService.getUser(event.getUser().getId(), event.getUser());
for (EventListener listener : LISTENERS) {
listener.onGuildMemberUnban(guild, user, event);
@ -272,7 +272,7 @@ public class EventService extends ListenerAdapter {
return;
}
BatGuild guild = guildService.getGuild(event.getGuild().getId());
BatUser user = userService.getUser(event.getUser().getId());
BatUser user = userService.getUser(event.getUser().getId(), event.getUser());
for (EventListener listener : LISTENERS) {
listener.onGuildMemberTimeout(guild, user, event);
@ -284,7 +284,7 @@ public class EventService extends ListenerAdapter {
if (event.getUser().isBot()) {
return;
}
BatUser user = userService.getUser(event.getUser().getId());
BatUser user = userService.getUser(event.getUser().getId(), event.getUser());
for (EventListener listener : LISTENERS) {
listener.onUserUpdateName(user, event.getOldName(), event.getNewName(), event);
@ -296,7 +296,7 @@ public class EventService extends ListenerAdapter {
if (event.getUser().isBot()) {
return;
}
BatUser user = userService.getUser(event.getUser().getId());
BatUser user = userService.getUser(event.getUser().getId(), event.getUser());
for (EventListener listener : LISTENERS) {
listener.onUserUpdateAvatar(user, event.getOldAvatarUrl(), event.getNewAvatarUrl(), event);
@ -309,7 +309,7 @@ public class EventService extends ListenerAdapter {
return;
}
BatGuild guild = guildService.getGuild(event.getEntity().getGuild().getId());
BatUser user = userService.getUser(event.getEntity().getUser().getId());
BatUser user = userService.getUser(event.getEntity().getUser().getId(), event.getEntity().getUser());
for (EventListener listener : LISTENERS) {
listener.onGuildVoiceUpdate(guild, user, event);