Hey. I really like your idea, but you definitely could make the code for this better :)
I suggest you use a while loop after a player joins, rather than looping all players every so often. This will help a lot, as looping all players every few ticks can be highly inefficient for different servers with more players or less hardware. Fantastic idea though!
You could even make a dehydration thing for deserts, or humid for swamps, or water logged for them being in water for too long, or checking the light level at the player when they are under a certain y coordinate and play scary sounds / spawn monsters ETC