This quote originated from China, at specific from Fan Li, an advisor for King Goujian of Yue (during the Spring and Autumn period). He serves King Goujian loyally with his friend Wen Zhong in the battlefield to defeat the State of Wu. TLDR; after King Fuchai from Wu committed suicide on his withdraw, a great ball held. But, Fan Li was nowhere to be found. Soon after, a letter from him came for Wen Zhong,
"飞鸟被杀光了,弓箭自然得藏起来;
兔子都猎光了,猎狗再无用处,可以杀来吃了;现在吴国已经灭亡,身为谋臣的我们再无用武之地。而且就越王为人而言,只能‘共患难’,不能‘同享安乐’。文种大夫至今还不离去,难免日后会招致杀身之祸。"
(
When all the birds have been killed, the bows and arrows must be hidden; when all the rabbits have been hunted, the hunting dogs are no longer useful and can be killed and eaten; now that the State of Wu has been destroyed, we, as advisors, are no longer useful. Moreover, as a person, the King of Yue can only ‘share hardships’ and cannot ‘share happiness’. Doctor Wenzhong still hasn't left, so he will inevitably suffer death in the future.)
Fan Li warned that the King of Yue was a man one could "share hardships with," but not "share happiness."
At this point, Wen Zhong learned that Fan Li actually still alive somewhere, yet he still doubted his friend's word and become skeptical about it. But, he also began claim illness and not attend the court after that. Of course, King Goujian's became suspicious. One day, The King visit Wen Zhong's place then leaves a sword here. When it checked, the sword engraved "属镂" on the scabbard. It was a method used by King Fuchai of Wu to forced his loyal minister Wu Zixu to commit suicide. That time, Wen Zhong regret it and realized the truth of his friend's advice.
Source:
Chinese site called Sohu(?)