[Refactoring] Use TypedPacket instead of string in HandlerSceneInitFinishReq and HandlerSetPlayerBornDataReq

This commit is contained in:
hartie95 2024-08-26 02:01:16 +02:00
parent 6158ff0fcc
commit dcee95240a
2 changed files with 5 additions and 4 deletions

View File

@ -2,11 +2,11 @@ package emu.grasscutter.server.packet.recv;
import emu.grasscutter.game.dungeons.DungeonManager;
import emu.grasscutter.game.player.Player.SceneLoadState;
import emu.grasscutter.game.world.WeatherArea;
import emu.grasscutter.net.packet.*;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.*;
import lombok.val;
import org.anime_game_servers.multi_proto.gi.messages.scene.SceneForceUnlockNotify;
import org.anime_game_servers.multi_proto.gi.messages.scene.SceneInitFinishReq;
import java.util.Optional;
@ -24,7 +24,7 @@ public class HandlerSceneInitFinishReq extends TypedPacketHandler<SceneInitFinis
session.send(new PacketWorldDataNotify(session.getPlayer().getWorld()));
session.send(new PacketWorldOwnerBlossomBriefInfoNotify(session.getPlayer().getWorld()));
session.send(new PacketPlayerWorldSceneInfoListNotify(session.getPlayer()));
session.send(new BasePacket(session.getPackageIdProvider().getPacketId("SceneForceUnlockNotify")));
session.send(new BaseTypedPacket<>(new SceneForceUnlockNotify()) {});
session.send(new PacketHostPlayerNotify(session.getPlayer().getWorld()));
session.send(new PacketSceneDataNotify(session.getPlayer()));
session.send(new PacketSceneTimeNotify(session.getPlayer()));

View File

@ -6,10 +6,11 @@ import emu.grasscutter.data.GameData;
import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.mail.Mail;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.BaseTypedPacket;
import emu.grasscutter.net.packet.TypedPacketHandler;
import emu.grasscutter.server.game.GameSession;
import org.anime_game_servers.multi_proto.gi.messages.player.SetPlayerBornDataReq;
import org.anime_game_servers.multi_proto.gi.messages.player.SetPlayerBornDataRsp;
import java.util.Arrays;
@ -56,7 +57,7 @@ public class HandlerSetPlayerBornDataReq extends TypedPacketHandler<SetPlayerBor
session.getPlayer().onPlayerBorn();
// Born resp packet
session.send(new BasePacket(session.getPackageIdProvider().getPacketId("SetPlayerBornDataRsp")));
session.send(new BaseTypedPacket<>(new SetPlayerBornDataRsp()) {});
// Default mail
var welcomeMail = GAME_INFO.joinOptions.welcomeMail;