Minecraft – Freezing all mobs, testing for a player in a boat, then unfreezing all mobs

minecraft-commandsminecraft-java-edition

Is there a way that I can freeze all mobs using a command, then test for a player getting on a boat, then unfreeze all the entities? If you are curious as to why I would be wondering this, here is a link to one of my other questions: Making mobs invincible

Best Answer

You could use the /effect command to apply slowness to every entity with a really high level and time as such:

/effect @e 2 1000000 255 true

Then when you detect your player in the boat (this is where my knowledge ends), you can clear the effect as such:

/effect @e clear