删错误宝器bug

back_recharge
jiahuiwen 2021-10-09 11:06:03 +08:00
parent 4133f80879
commit 3df6b64f82
1 changed files with 7 additions and 1 deletions

View File

@ -204,10 +204,11 @@ public class HeroLogic{
//宝器
if(type==4){
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
Set<String> needRemove = new HashSet<>(equipMap.size());
for(Map.Entry<String, PropertyItem> equipInfoEntry : equipMap.entrySet()){
PropertyItem value = equipInfoEntry.getValue();
if (value == null) {
equipManager.remove(equipInfoEntry.getKey());
needRemove.add(equipInfoEntry.getKey());
LOGGER.info("getAllEquipInfo uid={} remove null jewel{}", uid, equipInfoEntry.getKey());
continue;
}
@ -215,6 +216,11 @@ public class HeroLogic{
equipList.add(CBean2Proto.getEquipProto(value));
}
}
if (!needRemove.isEmpty()) {
for (String id : needRemove) {
equipManager.remove(id);
}
}
}else {
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}