Fix setPrevScene bug (#2396)

This commit is contained in:
Nazrin 2023-10-06 21:40:36 -07:00 committed by GitHub
parent 9a198bd231
commit d32a75e980
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,10 +15,11 @@ public class HandlerPersonalSceneJumpReq extends PacketHandler {
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
PersonalSceneJumpReq req = PersonalSceneJumpReq.parseFrom(payload); PersonalSceneJumpReq req = PersonalSceneJumpReq.parseFrom(payload);
var player = session.getPlayer(); var player = session.getPlayer();
var prevSceneId = player.getSceneId();
// get the scene point // get the scene point
ScenePointEntry scenePointEntry = ScenePointEntry scenePointEntry =
GameData.getScenePointEntryById(player.getSceneId(), req.getPointId()); GameData.getScenePointEntryById(prevSceneId, req.getPointId());
if (scenePointEntry != null) { if (scenePointEntry != null) {
Position pos = Position pos =
@ -26,6 +27,7 @@ public class HandlerPersonalSceneJumpReq extends PacketHandler {
int sceneId = scenePointEntry.getPointData().getTranSceneId(); int sceneId = scenePointEntry.getPointData().getTranSceneId();
player.getWorld().transferPlayerToScene(player, sceneId, pos); player.getWorld().transferPlayerToScene(player, sceneId, pos);
player.getScene().setPrevScene(prevSceneId);
session.send(new PacketPersonalSceneJumpRsp(sceneId, pos)); session.send(new PacketPersonalSceneJumpRsp(sceneId, pos));
} }
} }