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...