Discover the World of Pets
Your cat sits on the shelf, looks you dead in the eye, and sweeps your mug to the floor. It's tempting to take it personally. But before you accuse him of spite, consider that cats don't actually do revenge. What they do is explore, play, and sometimes act out stress, and the line between those and "jerk move" is entirely in the human reading of it.
So why the knocking?
Cats investigate the world with their feet. A small object on a ledge is something to pat, to test, to see if it moves. If it falls and you react, loudly, that's a bonus: you just turned a quiet object into the most interesting thing in the room. The behavior got rewarded with attention, which is cat currency.
Some cats genuinely seem to enjoy the cause-and-effect. Push, crash, human appears. From a cat's point of view that's a pretty good game.
Not every sweep is playful. A cat that starts knocking things after a routine change, a new pet, a move, a different work schedule, may be broadcasting stress. The acting out is the only language he has for "something feels off." Watch for other signs: hiding, not eating, overgrooming.
Boredom does it too. An indoor cat with nothing to do will invent entertainment, and your carefully arranged shelf is right there.
Don't reward the drama. A calm, boring "no" and immediate disinterest teaches him the game isn't fun. Move temptations, the mug, the keys, off the edge he favors.
Give him a better outlet. A window perch, a rotating toy, a daily play session that ends with a treat, these burn the energy that currently goes into your glassware. Cats that are played with and tired knock things over a lot less, because they've already spent the impulse elsewhere.
If it's stress-driven, fix the cause, not the symptom. More routine, a safe space, slower introductions of changes. The shelf-sweeping usually fades once the cat feels settled.
He's not getting back at you. He's a cat, doing cat things, with a shelf and a mug in reach. Move the mug, play with the cat, and the mystery solves itself.