The best way to change your mindset and avoid temptations is to become aware of your thoughts. Once you're aware of what you're thinking, you can identify which thoughts are helpful and which ones are unhelpful and lead you to give in to temptations. Then, you can work on challenging those unhelpful thoughts, which will ultimately help you make better decisions.