He has had a treat in Stafford Court. He has been thoroughly cudgelled. Of course the pun is on the word staff, a stick. The French have a similar phrase- “It a esté au festin de Martin Baston. ” (He has been to Jack Drum's entertainment).
Source: Dictionary of Phrase and Fable, E. Cobham Brewer, 1894