Set player spawn in custom dimension
I want the player to always spawn in a custom dimension once they've entered it, unitl they get out via the end portal.
I'm not entirely sure how to do it, I can't find a good easy way since with the spawpoint command the player looses their spawnpoint if they set it with a bed and then break it. it then defaults to the world spawn. And i cant change the world spawn because it can't be moved out of the overworld and it's not player specific so wouldn't work with multiplayer anyway.
So i guess my initial idea is to try to do something where it detects any player who's died in that dimension and if they don't have a spawnpoint in the dimension then it will set their spawpoint again, or just teleport them there. Means I will have to store their initial spawnpoints somehow.
Is this a good approach? am I missing anything that might make it easier/simpler?