A self-confessed drug dealer has been jailed for over two years.