Skip to content

Commit

Permalink
Fix setPrevScene bug (Grasscutters#2396)
Browse files Browse the repository at this point in the history
  • Loading branch information
scooterboo authored Oct 7, 2023
1 parent 9a198bd commit d32a75e
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@ public class HandlerPersonalSceneJumpReq extends PacketHandler {
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
PersonalSceneJumpReq req = PersonalSceneJumpReq.parseFrom(payload);
var player = session.getPlayer();
var prevSceneId = player.getSceneId();

// get the scene point
ScenePointEntry scenePointEntry =
GameData.getScenePointEntryById(player.getSceneId(), req.getPointId());
GameData.getScenePointEntryById(prevSceneId, req.getPointId());

if (scenePointEntry != null) {
Position pos =
scenePointEntry.getPointData().getTranPos().clone(); // This might not need cloning
int sceneId = scenePointEntry.getPointData().getTranSceneId();

player.getWorld().transferPlayerToScene(player, sceneId, pos);
player.getScene().setPrevScene(prevSceneId);
session.send(new PacketPersonalSceneJumpRsp(sceneId, pos));
}
}
Expand Down

0 comments on commit d32a75e

Please sign in to comment.