Should I use inflict on only for unpleasant situations?
not not necessary, but it is the most common use of "inflict on". It means to "strike against" or in daily use cause harm suffering or pain. But you can inflict discomfort by subtle means.
you could correctly say to someone "don't inflict your humour on me" = you do not find their humour funny, or offensive etc.
it could also be said to be translated in reverse. to mean "you do find their humour funny" and you can't stop right now to have a joking session etc.
English is full of these reversals in daily speech.
Inflict also has a medical meaning and a legal meaning.