execute as @a[team=!overworld] at @s if dimension minecraft:overworld run team join overworld execute as @a[team=!nether] at @s if dimension minecraft:the_nether run team join nether execute as @a[team=!end] at @s if dimension minecraft:the_end run team join end