You didn't play this wrong, if someone is shoving on you when you have a set then smile and call. On flop if he cbets you can just call him and turn if he cbets again you can raise him and if he shoves call, or if he then checks the turn then you can make it look like you just floated his flop cbet and bet out, and again if he shoves, you can call. The result does not matter, it is how you played it does!
For the record though, you didn't have trips, you had a set. This is the same mistake I made when I first started to play poker. Trips is when you hold one and the board holds 2... Say you have JKo and the flop has Jc5hJd you would have trips.