mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-05 00:53:04 +00:00
added check to unmute user, in case the user left the guild
added checks if users being awarded a role are still in the guild
This commit is contained in:
@@ -180,7 +180,9 @@ public class AUserExperienceServiceBean implements AUserExperienceService {
|
||||
boolean currentlyHasNoExperienceRole = userExperience.getCurrentExperienceRole() == null;
|
||||
if(role == null) {
|
||||
if(!currentlyHasNoExperienceRole){
|
||||
roleService.removeRoleFromUser(user, userExperience.getCurrentExperienceRole().getRole());
|
||||
if(botService.isUserInGuild(userExperience.getUser())) {
|
||||
roleService.removeRoleFromUser(user, userExperience.getCurrentExperienceRole().getRole());
|
||||
}
|
||||
}
|
||||
userExperience.setCurrentExperienceRole(null);
|
||||
return;
|
||||
@@ -190,7 +192,9 @@ public class AUserExperienceServiceBean implements AUserExperienceService {
|
||||
if(currentlyHasNoExperienceRole || !role.getRole().getId().equals(userExperience.getCurrentExperienceRole().getRole().getId())) {
|
||||
log.info("User {} in server {} gets a new role {}", user.getUserReference().getId(), user.getServerReference().getId(), role.getRole().getId());
|
||||
if(!currentlyHasNoExperienceRole) {
|
||||
roleService.removeRoleFromUser(user, userExperience.getCurrentExperienceRole().getRole());
|
||||
if(botService.isUserInGuild(userExperience.getUser())) {
|
||||
roleService.removeRoleFromUser(user, userExperience.getCurrentExperienceRole().getRole());
|
||||
}
|
||||
}
|
||||
roleService.addRoleToUser(user, role.getRole());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user