[Fix] Fixed dungeon spawn position using BeginPos instead of BornPos

This commit is contained in:
hartie95 2024-02-06 20:13:07 +01:00
parent ec326ff562
commit 2cfb63ea28
3 changed files with 10 additions and 3 deletions

View File

@ -2,7 +2,9 @@ package emu.grasscutter.command.commands;
import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.data.GameData;
import emu.grasscutter.game.player.Player;
import lombok.val;
import java.util.List;
@ -20,7 +22,12 @@ public final class EnterDungeonCommand implements CommandHandler {
try {
int dungeonId = Integer.parseInt(args.get(0));
if (dungeonId == targetPlayer.getSceneId()) {
val dungeonData = GameData.getDungeonDataMap().get(dungeonId);
if(dungeonData == null) {
CommandHandler.sendMessage(sender, translate(sender, "commands.enter_dungeon.not_found_error"));
return;
}
if (dungeonData.getSceneId() == targetPlayer.getSceneId() && targetPlayer.getScene().getCurDungeonId() == dungeonId) {
CommandHandler.sendMessage(sender, translate(sender, "commands.enter_dungeon.in_dungeon_error"));
return;
}

View File

@ -436,7 +436,7 @@ public class Scene {
}
private Position getDefaultLocation(Player player) {
val bornPost = this.scriptManager.getConfig().getBeginPos();
val bornPost = this.scriptManager.getConfig().getBornPos();
return bornPost != null ? new Position(bornPost) : player.getPosition();
}

View File

@ -310,7 +310,7 @@ public class World implements Iterable<Player> {
// }
val config = newScene.getScriptManager().getConfig();
if (teleportProperties.getTeleportTo() == null && config != null) {
Optional.ofNullable(config.getBeginPos()).map(Position::new).ifPresent(teleportProperties::setTeleportTo);
Optional.ofNullable(config.getBornPos()).map(Position::new).ifPresent(teleportProperties::setTeleportTo);
Optional.ofNullable(config.getBornRot()).map(Position::new).ifPresent(teleportProperties::setTeleportRot);
}