From 03ed9a5b412945361dbe536ab1a10c21e38498e3 Mon Sep 17 00:00:00 2001 From: Josh Roy <10731363+JRoy@users.noreply.github.com> Date: Thu, 8 Jun 2023 19:45:12 -0400 Subject: [PATCH] Fix roles/groups not being removed instantly upon unlink --- .../net/essentialsx/discordlink/AccountLinkManager.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/EssentialsDiscordLink/src/main/java/net/essentialsx/discordlink/AccountLinkManager.java b/EssentialsDiscordLink/src/main/java/net/essentialsx/discordlink/AccountLinkManager.java index a0ddfb9d1..982a37562 100644 --- a/EssentialsDiscordLink/src/main/java/net/essentialsx/discordlink/AccountLinkManager.java +++ b/EssentialsDiscordLink/src/main/java/net/essentialsx/discordlink/AccountLinkManager.java @@ -77,10 +77,11 @@ public class AccountLinkManager implements IEssentialsModule, DiscordLinkService ensureAsync(() -> { final IUser user = ess.getEss().getUser(uuid); ensureSync(() -> ess.getServer().getPluginManager().callEvent(new DiscordLinkStatusChangeEvent(user, member, member.getId(), false, cause))); + + roleSyncManager.unSync(uuid, member.getId()); }); return true; } - ensureAsync(() -> roleSyncManager.unSync(uuid, member.getId())); return false; } @@ -101,9 +102,10 @@ public class AccountLinkManager implements IEssentialsModule, DiscordLinkService if (storage.remove(user.getBase().getUniqueId())) { ess.getApi().getMemberById(id).thenAccept(member -> ensureSync(() -> ess.getServer().getPluginManager().callEvent(new DiscordLinkStatusChangeEvent(user, member, id, false, cause)))); + + ensureAsync(() -> roleSyncManager.unSync(user.getBase().getUniqueId(), id)); return true; } - ensureAsync(() -> roleSyncManager.unSync(user.getBase().getUniqueId(), id)); return false; }