A man has pleaded guilty to threatening to set a Swindon town centre pub on fire before storming out of court.