The students of SpringfieldElementary go on a field trip to the Springfield Glacier which has nearly melted completely into a pond, and is just a lump of slush. Lisa blames global warming, although a ranger does not agree with her. Meanwhile, Homer and Marge visit Sprawl-Mart (where their motto is "Not a parody of Wal-Mart," despite clear evidence to the contrary). Grandpa is a greeter, and gets into an accident, telling Homer that he should take over for the moment. Eventually, the manager tells Homer that he can become the full-time greeter without chance for advancement, which Homer likes because there is no pressure.
Back at the glacier, Bart bullies Lisa because of the fact that she is enjoying an educational field trip. He previously tripped her on the school bus, then carved a message saying "Lisa stinks" on a rock in the exhibit. While Lisa lectures the other students about global warming, Bart steals two walkie-talkies from the ranger station then places one in Lisa's backpack, and spits into the other, making it sound like she is passing gas. Everyone teases her, and Bart goes as far as to throw a snowball at Lisa, causing her to fall into the freezing pond. The last of the glacier melts, and Lisa emerges with a frog on her head. Furious, Lisa warns him that she will get revenge.
It turns out that the next morning, she has filed a restraining order against Bart. He now cannot come within 20 feet of Lisa. Bart starts to protest, which lands him in jail. In the next act, Homer contemplates over how to live with their kids apart. Chief Wiggum shows them "Get Out of My Dreams -- And Also Out of My Car," a video guide about dealing with restraining orders hosted by Gary Busey. Homer makes a 20-foot pole out of various items to make the order easy to enforce. He places the screwdriver at the end to "show Bart what it's like in the real world." Lisa enjoys poking Bart, and realizes how she can use her legal powers to give Bart his medicine. It leads to Bart being forced to be taught by Groundskeeper Willie in his tool shed (which smells like manure and has manure itself dripping on Bart). At lunch, while Lisa sits in comfort, Bart is out in the rain so he will not violate the restraining order. He needs to ride behind the school bus in a shopping cart. At the library, Lisa displaces Bart from the comics to the "Gay Interest" section (which causes the bullies to laugh at him). Dr. Hibbert diagnoses that Bart has suffered extensive nerve damage and, must be injected with an "anti poking potion". Dr. Hibbert implies that he does not know what the heck he's doing because he's distracted, as he repeatedly misses the vein, only hurting Bart even more. Back at Sprawl-Mart, Lisa enjoys eating in the cafeteria with Homer, especially without Bart. The manager tells Homer that if he does not work overtime without a bonus, he will be shipped back to Mexico, having been shown a counterfeit Mexican ID. Marge then decides to get an appeal for lifting the restraining order. During the trial, Bart accidentally insults Judge Harm by saying she has no sense of humor, who therefore augments the terms so that Bart must remain 200 feet from Lisa.
Now, Bart has to camp out in the backyard (which appears much larger than normal). He then realizes that he can live the natural way. He takes his shirt, shoes and socks off, runs around, can urinate anywhere, and plays around with dogs and fights raccoons. Watching him through binoculars, Marge suggests to Lisa that she may have gone too far. Lisa responds that Bart has not done three nice things for her (which contradicts the many nice things he has done for her, as seen in many past episodes), but is then reminded of two (one of which Bart thought he was doing something mean to her), and promises to destroy the order if she can think of a third. Back at Sprawl-Mart, Homer and his co-workers are locked in late at night, with a chip implanted in the back of Homer's neck, but he removes it and joins his co-workers in robbing the store by using a forklift to steal several plasma TVs. When Bart builds a statue of Lisa, she is impressed, thinking that it is the third good deed. When she finds out that it was going to be burned, and Bart lies about why, Lisa says how she misses Bart's lies. She burns the restraining order and the poke pole, while the family reunites, playing Tijuana Taxi (while Bart chases the cat).