How to "sleep"?

Eg. player enters a command, and three seconds later, a zombie spawns. How would I code “three seconds later”?

Well, you could listen for the command entered and then use the sponge Task.builder to run a code with a certain delay. Should be exactly what you want.