From bd536961e254e389ecf36160cd81cbd7886b05ad Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 11 May 2024 17:43:34 -0500 Subject: [PATCH] removal group guil refreshes group windows --- .../handlers/BanishUnbanishHandler.java | 22 ++++++++++++++----- .../client/handlers/LeaveGuildHandler.java | 15 ++++++++++++- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/engine/net/client/handlers/BanishUnbanishHandler.java b/src/engine/net/client/handlers/BanishUnbanishHandler.java index 497c88b9..a67fb45f 100644 --- a/src/engine/net/client/handlers/BanishUnbanishHandler.java +++ b/src/engine/net/client/handlers/BanishUnbanishHandler.java @@ -21,12 +21,10 @@ import engine.net.DispatchMessage; import engine.net.client.ClientConnection; import engine.net.client.msg.ClientNetMsg; import engine.net.client.msg.ErrorPopupMsg; +import engine.net.client.msg.group.GroupUpdateMsg; import engine.net.client.msg.guild.BanishUnbanishMsg; import engine.net.client.msg.guild.GuildListMsg; -import engine.objects.Guild; -import engine.objects.GuildHistory; -import engine.objects.GuildStatusController; -import engine.objects.PlayerCharacter; +import engine.objects.*; import org.joda.time.DateTime; public class BanishUnbanishHandler extends AbstractClientMsgHandler { @@ -117,8 +115,20 @@ public class BanishUnbanishHandler extends AbstractClientMsgHandler { GuildListMsg guildListMsg = new GuildListMsg(guild); dispatch = Dispatch.borrow(source, guildListMsg); DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY); - if(GroupManager.getGroup(target) != null) - GroupManager.removeFromGroups(PlayerCharacter.getFromCache(target)); + if(GroupManager.getGroup(target) != null) { + Group group = GroupManager.getGroup(target); + group.removeGroupMember(PlayerCharacter.getPlayerCharacter(target)); + GroupManager.removeFromGroups(PlayerCharacter.getPlayerCharacter(target)); + GroupUpdateMsg gim; + gim = new GroupUpdateMsg(); + gim.setGroup(group); + gim.setMessageType(3); + gim.setPlayer(PlayerCharacter.getPlayerCharacter(target)); + group.sendUpdate(gim); + + String text = PlayerCharacter.getPlayerCharacter(target).getFirstName() + " has left your group."; + ChatManager.chatGroupInfo(source, text); + } } else { ErrorPopupMsg.sendErrorPopup(source, 103); // You may not banish this char } diff --git a/src/engine/net/client/handlers/LeaveGuildHandler.java b/src/engine/net/client/handlers/LeaveGuildHandler.java index ab9d7d2e..45cb24ed 100644 --- a/src/engine/net/client/handlers/LeaveGuildHandler.java +++ b/src/engine/net/client/handlers/LeaveGuildHandler.java @@ -18,6 +18,7 @@ import engine.net.Dispatch; import engine.net.DispatchMessage; import engine.net.client.ClientConnection; import engine.net.client.msg.ClientNetMsg; +import engine.net.client.msg.group.GroupUpdateMsg; import engine.net.client.msg.guild.LeaveGuildMsg; import engine.objects.*; @@ -59,8 +60,20 @@ public class LeaveGuildHandler extends AbstractClientMsgHandler { return true; } - if(GroupManager.getGroup(playerCharacter) != null) + if(GroupManager.getGroup(playerCharacter) != null) { + Group group = GroupManager.getGroup(playerCharacter); + group.removeGroupMember(playerCharacter); GroupManager.removeFromGroups(playerCharacter); + GroupUpdateMsg gim; + gim = new GroupUpdateMsg(); + gim.setGroup(group); + gim.setMessageType(3); + gim.setPlayer(playerCharacter); + group.sendUpdate(gim); + + String text = playerCharacter.getFirstName() + " has left your group."; + ChatManager.chatGroupInfo(playerCharacter, text); + } // Send left guild message to rest of guild ChatManager.chatGuildInfo(oldGuild, playerCharacter.getFirstName() + " has left the guild.");