I met many interesting people in dreams or in visions awake: Jesus, my old Zen teacher, some other Buddhist and Hindu teachers and so on.
Some of them have told me very powerful mantras, some have encouraged me in practice or pointed at my mistakes. And of course I practised with them in my dreams, with joy and benefit. In none of those dreams or visions they deceived me in anything.
My old Zen teacher said (when another practitioner asked him) that he doesn't visit his students in dreams. But, he said, it's possible that some local spirit might took his appearance and give helpful advice.
Likewise, in your case it's possible that a local spirit took an image of the Buddha and gave you good advice. And it's possible it was real Buddha.
There are known stories of advanced practitioners who saw awakened teachers in dreams or visions and learned from them a lot. For example, if I recall correctly, Je Tsongkhapa meditated in a temple with a statue of Atisha, and Atisha started to talk to him and elucidated many topics of Dharma, and that allowed Tsongkhapa to write his fundamental Lamrim.
Of course it happens that our mind plays tricks with us, so it's possible to receive ill advice in dreams as well. Bodhisattvas can see Buddhas of Sambhogakaya realm (invisible to regular people), until then we have to decide for ourselves, was the advice good or not.
...Anyway, some people found excuses to not follow advice of real Buddha, when he was in human body...