This is just what *I* do with mine, who is a great rooster with an occasional uppity moment.
Whenever Carl flaps a wing at me or pecks my leg as I'm walking, I stop and turn and walk deliberately AT him. Right up next to him, to make him back up. If he sidesteps me, I keep turning and walking toward him. I do this until he actualy turns away, which is a "give up" action. I don't chase him. I don't follow him any more, just continue walking past him. IF he makes another move toward me, which is very very rare, I start the walking at him process again.
Basically, I'm making him back down. I'm the Boss of Him.
When hand-feeding treats to the flock, I always toss some where he can check it out. If he comes up to eat from my hands, I let him, which he will do and then step back to let the ladies eat right away. He's a very good roo, a gentleman to his ladies (now that he's grown up), and he settles hen squabbles. He is very alert and appropriately warns the flock when necessary. I think he's really handsome. He doesn't mind the bantam roos in the flock, but he won't let them mount the hens if he sees them doing so. He's got two favorite hens and it's SO cute to watch him snuggle with them, dust bathe with them, and just wander the yard with one of them beside him.
He sometimes tries to make me one of his hens by bringing me an oddly-shaped pebble, a special twig, or a pretty leaf, making that "Come Hither, My Sweet" call and offering them to me. I never accept them because I am NOT one of his hens - I am the Boss of Him. (But I do think it's adorable behavior.)
I have more trouble with my bantam roosters and *sigh* may have to re-home some of them.