Two burglars were caught after a landlady watched them on CCTV as they stole charity boxes and alcohol from the bar of her pub.
A court heard Paul Everitt and Barry Laws carried out the raid at the Old Mill, Horbury, Wakefield, in the early hours of September 10 this year.
The pair forced a door to get inside the premises at around 3.15am after the manager had locked up and gone upstairs.
An alarm was activated as the men took bottles of spirits from behind the bar. The landlady was advised to stay upstairs when she dialled 999 after seeing them on a CCTV system.
Police officers arrived at the premises a short time later and found Everitt and Laws hiding inside the bar area. They were found in possession of screwdrivers, pliers and scissors.
Everitt, 39, of Old Crown Road, Lupset, and Laws, 34, of Henderson Avenue, Normanton, pleaded guilty to burglary.
The court heard both men have lengthy previous convictions for burglary and other offences of dishonesty. Everitt was the subject of a suspended prison sentence at the time of the break-in.
He was jailed for 18 months, while Laws was jailed for 16.
Robert Galley, prosecuting, said the offence had made the landlady fearful of being able to do her job in the future.
Howard Shaw, mitigating, said the pair had pleaded guilty at an early stage. Mr Shaw said they had planned to sell the alcohol in order to raise money to buy drugs.
Judge Neil Clark described the theft of the charity boxes as “unforgivable”.
He added: “This is a serious offence of its type. There were two of you acting together and you were equipped to do this.
“It is clear from what she has said that [the victim] has suffered and has been nervous and worried as a result of this.”