Fix roles/groups not being removed instantly upon unlink

This commit is contained in:
Josh Roy 2023-06-08 19:45:12 -04:00 committed by MD
parent d67dd46cdc
commit 03ed9a5b41

View File

@ -77,10 +77,11 @@ public class AccountLinkManager implements IEssentialsModule, DiscordLinkService
ensureAsync(() -> { ensureAsync(() -> {
final IUser user = ess.getEss().getUser(uuid); final IUser user = ess.getEss().getUser(uuid);
ensureSync(() -> ess.getServer().getPluginManager().callEvent(new DiscordLinkStatusChangeEvent(user, member, member.getId(), false, cause))); ensureSync(() -> ess.getServer().getPluginManager().callEvent(new DiscordLinkStatusChangeEvent(user, member, member.getId(), false, cause)));
roleSyncManager.unSync(uuid, member.getId());
}); });
return true; return true;
} }
ensureAsync(() -> roleSyncManager.unSync(uuid, member.getId()));
return false; return false;
} }
@ -101,9 +102,10 @@ public class AccountLinkManager implements IEssentialsModule, DiscordLinkService
if (storage.remove(user.getBase().getUniqueId())) { if (storage.remove(user.getBase().getUniqueId())) {
ess.getApi().getMemberById(id).thenAccept(member -> ensureSync(() -> ess.getApi().getMemberById(id).thenAccept(member -> ensureSync(() ->
ess.getServer().getPluginManager().callEvent(new DiscordLinkStatusChangeEvent(user, member, id, false, cause)))); ess.getServer().getPluginManager().callEvent(new DiscordLinkStatusChangeEvent(user, member, id, false, cause))));
ensureAsync(() -> roleSyncManager.unSync(user.getBase().getUniqueId(), id));
return true; return true;
} }
ensureAsync(() -> roleSyncManager.unSync(user.getBase().getUniqueId(), id));
return false; return false;
} }