From bddb96e3b2b80ebb629b984417b2b9d396bdf345 Mon Sep 17 00:00:00 2001 From: zhaodice <63996691+zhaodice@users.noreply.github.com> Date: Fri, 17 Jun 2022 14:34:30 +0800 Subject: [PATCH] Fix friend request pending list --- .../recv/HandlerGetPlayerAskFriendListReq.java | 15 +++++++++++++++ .../packet/send/PacketGetPlayerFriendListRsp.java | 10 +--------- 2 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerAskFriendListReq.java diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerAskFriendListReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerAskFriendListReq.java new file mode 100644 index 000000000..f19c84070 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerAskFriendListReq.java @@ -0,0 +1,15 @@ +package emu.grasscutter.server.packet.recv; + +import emu.grasscutter.net.packet.Opcodes; +import emu.grasscutter.net.packet.PacketHandler; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.server.game.GameSession; +import emu.grasscutter.server.packet.send.PacketGetPlayerAskFriendListRsp; + +@Opcodes(PacketOpcodes.GetPlayerAskFriendListReq) +public class HandlerGetPlayerAskFriendListReq extends PacketHandler { + @Override + public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { + session.send(new PacketGetPlayerAskFriendListRsp(session.getPlayer())); + } +} diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerFriendListRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerFriendListRsp.java index 1ca159d57..7bea1374a 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerFriendListRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerFriendListRsp.java @@ -39,15 +39,7 @@ public class PacketGetPlayerFriendListRsp extends BasePacket { for (Friendship friendship : player.getFriendsList().getFriends().values()) { proto.addFriendList(friendship.toProto()); } - - for (Friendship friendship : player.getFriendsList().getPendingFriends().values()) { - if (friendship.getAskerId() == player.getUid()) { - continue; - } - - proto.addAskFriendList(friendship.toProto()); - } - + this.setData(proto); } }