-After finding out the reasons of your masturbation, your next mission is to handle the situation. Handling a situation is a great skill which you need to constantly practice. In any situation, you need to control your feelings, not the other way around. Feeling is the sum total of your thoughts, your ways to interpret the world, and your attitude to other as well as to life. It is all up to you how you build up your feelings and deal with it. If you feel bored with the world, the world is not responsible for that. It is your way of looking which makes you feel bored.
Think of a colorful spectacle. The world seem to be red colored if you wear a red spectacle, yellow if you choose a yellow one, black if the glass is black. Feelings also work the same way. If you want to get pain, you can get it from anywhere. If you want to feel lonely, you will not find anyone beside you even though you are in a crowd of friends.
So, before stopping masturbation, start changing your spectacle. If the situation makes you bored and compels you to masturbate, utter yourself that you are not bored. Feeling lonely? Go out of your house and meet other people, or let others come in your life. Forget your painful past and find happiness in the present. Controlling your emotions will build a good personality in you, and it will help you to stop masturbation or any kind of addiction.