Minecraft Doing things in certain conditions?

Fr
- in Servers
1

Short and crisp if there are more than 5 players on the server then zombies should be spawned at one point but if there are under 5 no new zombies should be spawned

again in detail:

if there are under 5 players on the server then the spawn process of the zombies should be stopped but if it is over 5 then the spawn process should be continued

Ma

Do you have a scheduler in your main class? In the scheduler you ask the number of online players, is it 5 or higher you just do spawnEntity.