import { world, system, Dimension } from "@minecraft/server";

const overworld = world.getDimension("overworld");
const nether = world.getDimension("nether");
const the_end = world.getDimension("the_end");

export async function playerSafeTeleport(player, loc, dim=overworld) {

	const dimName = dim.id.replace('minecraft:', '');

	await player.runCommandAsync(`execute in ${dimName} run tp ${loc.x} ${loc.y} ${loc.z}`);

}