How To Stop A Kitten From Jumping On You?

I was trying to stop a kitten from jumping on me and it worked! I tried the “scratch” thing but he still jumped. When he did jump, I would pet him until he calmed down and then continue stroking him until he gave up..