From decf4942344b4d8350a2ef4a177cbea07928acaa Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 2 Sep 2023 05:49:00 +0000 Subject: [PATCH] Format code [skip actions] --- .../emu/grasscutter/game/home/GameHome.java | 31 ++++++++++--------- .../packet/recv/HandlerHomeAvatarTalkReq.java | 7 ++++- .../PacketHomeAvatarTalkFinishInfoNotify.java | 5 +-- .../packet/send/PacketHomeAvatarTalkRsp.java | 13 ++++---- 4 files changed, 33 insertions(+), 23 deletions(-) diff --git a/src/main/java/emu/grasscutter/game/home/GameHome.java b/src/main/java/emu/grasscutter/game/home/GameHome.java index b0b955a5c..b9ddd1d71 100644 --- a/src/main/java/emu/grasscutter/game/home/GameHome.java +++ b/src/main/java/emu/grasscutter/game/home/GameHome.java @@ -12,7 +12,6 @@ import emu.grasscutter.game.props.SceneType; import emu.grasscutter.net.proto.HomeAvatarTalkFinishInfoOuterClass; import emu.grasscutter.server.packet.send.*; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; - import java.time.ZonedDateTime; import java.time.temporal.ChronoUnit; import java.util.*; @@ -70,12 +69,12 @@ public class GameHome { public static GameHome create(Integer uid) { return GameHome.of() - .ownerUid(uid) - .level(1) - .sceneMap(new ConcurrentHashMap<>()) - .unlockedHomeBgmList(new HashSet<>()) - .finishedTalkIdMap(new HashMap<>()) - .build(); + .ownerUid(uid) + .level(1) + .sceneMap(new ConcurrentHashMap<>()) + .unlockedHomeBgmList(new HashSet<>()) + .finishedTalkIdMap(new HashMap<>()) + .build(); } public void save() { @@ -157,17 +156,21 @@ public class GameHome { return this.finishedTalkIdMap.get(avatarId); } - public List toAvatarTalkFinishInfoProto() { + public List + toAvatarTalkFinishInfoProto() { if (this.finishedTalkIdMap == null) { this.finishedTalkIdMap = new HashMap<>(); } - return this.finishedTalkIdMap.entrySet().stream().map(e -> { - return HomeAvatarTalkFinishInfoOuterClass.HomeAvatarTalkFinishInfo.newBuilder() - .setAvatarId(e.getKey()) - .addAllFinishTalkIdList(e.getValue()) - .build(); - }).toList(); + return this.finishedTalkIdMap.entrySet().stream() + .map( + e -> { + return HomeAvatarTalkFinishInfoOuterClass.HomeAvatarTalkFinishInfo.newBuilder() + .setAvatarId(e.getKey()) + .addAllFinishTalkIdList(e.getValue()) + .build(); + }) + .toList(); } public boolean addUnlockedHomeBgm(int homeBgmId) { diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeAvatarTalkReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeAvatarTalkReq.java index 383987329..6cd2d1ad0 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeAvatarTalkReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeAvatarTalkReq.java @@ -13,7 +13,12 @@ public class HandlerHomeAvatarTalkReq extends PacketHandler { @Override public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { var req = HomeAvatarTalkReqOuterClass.HomeAvatarTalkReq.parseFrom(payload); - var talkIdSet = session.getPlayer().getCurHomeWorld().getHome().onTalkedWithAvatar(req.getAvatarId(), req.getTalkId()); + var talkIdSet = + session + .getPlayer() + .getCurHomeWorld() + .getHome() + .onTalkedWithAvatar(req.getAvatarId(), req.getTalkId()); session.send(new PacketHomeAvatarTalkFinishInfoNotify(session.getPlayer())); session.send(new PacketHomeAvatarTalkRsp(req.getAvatarId(), talkIdSet)); } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketHomeAvatarTalkFinishInfoNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketHomeAvatarTalkFinishInfoNotify.java index 6ae06e3e1..665a944aa 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketHomeAvatarTalkFinishInfoNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketHomeAvatarTalkFinishInfoNotify.java @@ -9,7 +9,8 @@ public class PacketHomeAvatarTalkFinishInfoNotify extends BasePacket { public PacketHomeAvatarTalkFinishInfoNotify(Player homeOwner) { super(PacketOpcodes.HomeAvatarTalkFinishInfoNotify); - this.setData(HomeAvatarTalkFinishInfoNotifyOuterClass.HomeAvatarTalkFinishInfoNotify.newBuilder() - .addAllAvatarTalkInfoList(homeOwner.getHome().toAvatarTalkFinishInfoProto())); + this.setData( + HomeAvatarTalkFinishInfoNotifyOuterClass.HomeAvatarTalkFinishInfoNotify.newBuilder() + .addAllAvatarTalkInfoList(homeOwner.getHome().toAvatarTalkFinishInfoProto())); } } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketHomeAvatarTalkRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketHomeAvatarTalkRsp.java index 7068fa815..e015f1ae2 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketHomeAvatarTalkRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketHomeAvatarTalkRsp.java @@ -4,17 +4,18 @@ import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.HomeAvatarTalkFinishInfoOuterClass; import emu.grasscutter.net.proto.HomeAvatarTalkRspOuterClass; - import java.util.Set; public class PacketHomeAvatarTalkRsp extends BasePacket { public PacketHomeAvatarTalkRsp(int avatarId, Set talkIdSet) { super(PacketOpcodes.HomeAvatarTalkRsp); - this.setData(HomeAvatarTalkRspOuterClass.HomeAvatarTalkRsp.newBuilder() - .setAvatarTalkInfo(HomeAvatarTalkFinishInfoOuterClass.HomeAvatarTalkFinishInfo.newBuilder() - .setAvatarId(avatarId) - .addAllFinishTalkIdList(talkIdSet) - .build())); + this.setData( + HomeAvatarTalkRspOuterClass.HomeAvatarTalkRsp.newBuilder() + .setAvatarTalkInfo( + HomeAvatarTalkFinishInfoOuterClass.HomeAvatarTalkFinishInfo.newBuilder() + .setAvatarId(avatarId) + .addAllFinishTalkIdList(talkIdSet) + .build())); } }