diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/home/ArchitectureUnLockHandler.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/home/ArchitectureUnLockHandler.java index 27d4670cd..ab0000c93 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/home/ArchitectureUnLockHandler.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/home/ArchitectureUnLockHandler.java @@ -48,6 +48,7 @@ public class ArchitectureUnLockHandler implements IEventHandler { List collect = STableManager.getConfig(SHomeLand.class).values().stream().sorted(Comparator.comparing(SHomeLand::getSort)).collect(Collectors.toList()); Map levelMap = STableManager.getConfig(SHomeLandLevel.class); int nowInt = TimeUtils.nowInt(); + HashSet set = new HashSet<>(); for (SHomeLand land : collect) { // 不进版本 if (land.getIsOpen() != 1) { @@ -70,6 +71,7 @@ public class ArchitectureUnLockHandler implements IEventHandler { if (user.getPlayerInfoManager().getLevel() >= land.getUnlockLevel()[1]) { ArchitectureInfo architectureInfo = new ArchitectureInfo(id, nowInt, 0); user.getPlayerInfoManager().putArchitectureInfo(land.getId(),architectureInfo); + set.add(land.getId()); } break; case 2: @@ -86,6 +88,7 @@ public class ArchitectureUnLockHandler implements IEventHandler { } ArchitectureInfo architectureInfo = new ArchitectureInfo(id, nowInt, 0); user.getPlayerInfoManager().putArchitectureInfo(land.getId(),architectureInfo); + set.add(land.getId()); break; default: // 其他条件暂不处理,有需求再加 @@ -107,7 +110,7 @@ public class ArchitectureUnLockHandler implements IEventHandler { user.getEquipManager().putEquipIntensifyMap(4,levelId); } } - sendArchitectureUnlockIndication(user); + sendArchitectureUnlockIndication(user,set); } } @@ -115,8 +118,20 @@ public class ArchitectureUnLockHandler implements IEventHandler { * 建筑解锁推送 * @param user */ - private void sendArchitectureUnlockIndication(User user) throws Exception { - List infoList = CBean2Proto.getArchitectureInfoList(user); + private void sendArchitectureUnlockIndication(User user, Set set) throws Exception { + if (set.isEmpty()){ + return; + } + Map infoMap = user.getPlayerInfoManager().getArchitectureInfoMap(); + List infoList = new ArrayList<>(); + for (Integer value : set) { + ArchitectureInfo info = infoMap.get(value); + if (info == null){ + continue; + } + CommonProto.ArchitectureInfo.Builder builder = CommonProto.ArchitectureInfo.newBuilder().setId(info.getId()).setProductionStartTime(info.getProductionStartTime()).setUpLvEndTime(info.getUpLvEndTime()); + infoList.add(builder.build()); + } PlayerInfoProto.ArchitectureUnlockIndication.Builder builder = PlayerInfoProto.ArchitectureUnlockIndication.newBuilder().addAllInfos(infoList); ISession session = OnlineUserManager.getSessionByUid(user.getId()); MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.ArchitectureUnlockIndication_VALUE, builder.build(), true);