I've trained cats out of this, the most important thing is to stop playing immediately if the cat nips your hand. Don't get excited, don't pull your hand away suddenly. Just stop playing, and completely ignore the cat. They will get the message. Secondly, use toys for playing, you may be able to hold the toy in your hand and play 'tug of war' with it, or you may have to use a fishing toy, on a stick and string.
Some cats like to play 'fetch' as well, which is very cute.
The thing is to encourage the cat to play, but not with your hands.