This sentence comes from Jin Ying's Motto in Qing Dynasty. This is a famous saying of Confucian moral cultivation and an important part of China traditional culture. It reminds people to pay attention to self-reflection and respect for others in their daily lives, and to be moral, cultured and wise.
Similarly, this sentence also reminds us to have the spirit of suffering. Being willing to suffer doesn't mean being stupid. Virtue can only be revealed by respecting gentlemen, but it is not incompetent to be afraid of villains. If you have something to be proud of, don't always be cheerful, but be more modest and low-key. These are all manifestations of noble character and moral cultivation.
In a word, "sitting and thinking about yourself and gossiping about others" is an excellent moral quality and code of conduct, which is worth practicing by each of us.