Format code [skip actions]

This commit is contained in:
github-actions 2023-09-02 15:55:11 +00:00
parent ed97201473
commit f8fb6732de
7 changed files with 70 additions and 58 deletions

View File

@ -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.*;
@ -86,7 +85,10 @@ public class GameHome {
// Data fixer.
private void fixMainHouseIfOld() {
if (this.getMainHouseMap() == null) {
Grasscutter.getLogger().debug("Player {}'s main house will be deleted due to GC update! (ps. sorry XD)", this.getPlayer().getUid());
Grasscutter.getLogger()
.debug(
"Player {}'s main house will be deleted due to GC update! (ps. sorry XD)",
this.getPlayer().getUid());
this.mainHouseMap = new ConcurrentHashMap<>(); // assign.
}
@ -121,16 +123,22 @@ public class GameHome {
}
public HomeSceneItem getMainHouseItem(int outdoorSceneId) {
return this.getMainHouseMap().computeIfAbsent(outdoorSceneId, integer -> {
return this.getMainHouseMap()
.computeIfAbsent(
outdoorSceneId,
integer -> {
var curHomeSceneItem = this.getHomeSceneItem(outdoorSceneId);
var roomSceneId = curHomeSceneItem.getRoomSceneId();
var defaultItem = GameData.getHomeworldDefaultSaveData().get(roomSceneId);
if (defaultItem == null) {
Grasscutter.getLogger().info("defaultItem == null! returns Liyue style house.");
return HomeSceneItem.parseFrom(GameData.getHomeworldDefaultSaveData().get(2202), 2202); // Liyue style
return HomeSceneItem.parseFrom(
GameData.getHomeworldDefaultSaveData().get(2202), 2202); // Liyue style
}
Grasscutter.getLogger().info("Set player {} main house {} to initial setting", this.ownerUid, roomSceneId);
Grasscutter.getLogger()
.info(
"Set player {} main house {} to initial setting", this.ownerUid, roomSceneId);
return HomeSceneItem.parseFrom(defaultItem, roomSceneId);
});
}

View File

@ -5,7 +5,6 @@ import emu.grasscutter.data.GameData;
import emu.grasscutter.data.binout.HomeworldDefaultSaveData;
import emu.grasscutter.data.excels.ItemData;
import emu.grasscutter.game.world.Position;
import emu.grasscutter.net.proto.*;
import java.util.Set;
import java.util.stream.Collectors;

View File

@ -9,7 +9,6 @@ import emu.grasscutter.game.entity.EntityHomeAnimal;
import emu.grasscutter.game.world.Position;
import emu.grasscutter.game.world.Scene;
import emu.grasscutter.net.proto.HomeSceneArrangementInfoOuterClass.HomeSceneArrangementInfo;
import java.util.Collection;
import java.util.List;
import java.util.Map;

View File

@ -8,7 +8,6 @@ import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.HomeChangeModuleReqOuterClass;
import emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketHomeAvatarTalkFinishInfoNotify;
import emu.grasscutter.server.packet.send.PacketHomeChangeModuleRsp;
import emu.grasscutter.server.packet.send.PacketHomeComfortInfoNotify;

View File

@ -5,9 +5,8 @@ import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.HomeUpdateArrangementInfoReqOuterClass;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketHomeBasicInfoNotify;
import emu.grasscutter.server.packet.send.PacketHomeAvatarTalkFinishInfoNotify;
import emu.grasscutter.server.packet.send.PacketHomeBasicInfoNotify;
import emu.grasscutter.server.packet.send.PacketHomeMarkPointNotify;
import emu.grasscutter.server.packet.send.PacketHomeUpdateArrangementInfoRsp;
@ -28,7 +27,8 @@ public class HandlerHomeUpdateArrangementInfoReq extends PacketHandler {
session.getPlayer().getHome().onMainHouseChanged();
}
session.send(new PacketHomeBasicInfoNotify(session.getPlayer(), session.getPlayer().isInEditMode()));
session.send(
new PacketHomeBasicInfoNotify(session.getPlayer(), session.getPlayer().isInEditMode()));
session.send(new PacketHomeAvatarTalkFinishInfoNotify(session.getPlayer()));
session.send(new PacketHomeMarkPointNotify(session.getPlayer()));

View File

@ -22,7 +22,8 @@ public class PacketHomeChangeModuleRsp extends BasePacket {
public PacketHomeChangeModuleRsp() {
super(PacketOpcodes.HomeChangeModuleRsp);
this.setData(HomeChangeModuleRspOuterClass.HomeChangeModuleRsp.newBuilder()
this.setData(
HomeChangeModuleRspOuterClass.HomeChangeModuleRsp.newBuilder()
.setRetcode(RetcodeOuterClass.Retcode.RET_HOME_HAS_GUEST_VALUE));
}
}

View File

@ -3,7 +3,6 @@ package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.home.HomeBlockItem;
import emu.grasscutter.game.home.HomeMarkPointProtoFactory;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.*;
import emu.grasscutter.net.proto.*;
import java.util.Collection;
@ -28,7 +27,9 @@ public class PacketHomeMarkPointNotify extends BasePacket {
var homeScene = home.getHomeSceneItem(moduleId + 2000);
var mainHouse = home.getMainHouseItem(moduleId + 2000);
Set.of(homeScene, mainHouse).forEach(homeSceneItem -> {
Set.of(homeScene, mainHouse)
.forEach(
homeSceneItem -> {
var markPointData =
HomeMarkPointSceneDataOuterClass.HomeMarkPointSceneData.newBuilder()
.setModuleId(moduleId)
@ -36,11 +37,16 @@ public class PacketHomeMarkPointNotify extends BasePacket {
if (!homeSceneItem.isRoom()) {
var config = world.getSceneById(moduleId + 2000).getScriptManager().getConfig();
markPointData.setSafePointPos(config == null ? homeSceneItem.getBornPos().toProto() : config.born_pos.toProto())
markPointData
.setSafePointPos(
config == null
? homeSceneItem.getBornPos().toProto()
: config.born_pos.toProto())
.setTeapotSpiritPos(homeSceneItem.getDjinnPos().toProto());
}
var marks = homeSceneItem.getBlockItems().values().stream()
var marks =
homeSceneItem.getBlockItems().values().stream()
.map(HomeBlockItem::getMarkPointProtoFactories)
.flatMap(Collection::stream)
.filter(HomeMarkPointProtoFactory::isProtoConvertible)