Move player mail to MailHandler class

This is so we dont have to save the entire player to the db every time we send mail
This commit is contained in:
Melledy
2022-05-02 02:01:01 -07:00
parent e60cf79309
commit 63c7f8d62d
7 changed files with 176 additions and 52 deletions

View File

@@ -13,17 +13,10 @@ public class PacketDelMailRsp extends BasePacket {
public PacketDelMailRsp(Player player, List<Integer> toDeleteIds) {
super(PacketOpcodes.DelMailRsp);
DelMailRsp.Builder proto = DelMailRsp.newBuilder();
List<Integer> deletedIds = new ArrayList<>();
for(int mailId : toDeleteIds) {
if(player.deleteMail(mailId)) {
deletedIds.add(mailId);
}
}
this.setData(proto.build());
player.getSession().send(new PacketMailChangeNotify(player, null, deletedIds));
DelMailRsp proto = DelMailRsp.newBuilder()
.addAllMailIdList(toDeleteIds)
.build();
this.setData(proto);
}
}