Minecraft command block teleportion runaway

Solution 1:

So after some finangling, I figured out that I should use execute to test whether the previous ship has been deleted to stop the runaway reaction, and I am going to post the commands I used so that anyone else suffering through this spaghetti will also be able to do this.

I used a chain of 3 command blocks with the following commands:

/execute if block ~-6 ~-3 ~1 minecraft:air run clone ~-2 ~-9 ~-2 ~24 ~9 ~4 ~28 ~-9 ~-2 replace

/execute if block ~-6 ~-2 ~1 minecraft:air run execute as @a[distance=..25] at @s run tp @s ~30 ~ ~

/fill ~-6 ~-6 ~-2 ~-32 ~11 ~4 minecraft:air

The coordinates in the execute statement is a block in the build that was easy to reach. I don't know if this will work with the /clone move command but I'm happy with just using the 3 command blocks and calling it a day.