7:20,21
Achan then admits his sin, followed by an attempt to explain his actions. He saw the robe, silver and gold, and coveted them. I.e. he wanted something that he was not entitled to, for they were to be devoted to the Lord. Seeing that the robe was beautiful was not the problem, the problem was his taking the robe. Then he tells them where he had hidden the goods.
7:22-26
So Joshua sent messengers to seek out the illicit items. They brought them out and spread them out in front of Joshua and the people. So everyone could see that Achan was indeed the guilty party. Achan, his family and all his animals were brought out into the Valley of Achor. By his actions Achanhad brought trouble upon the whole nation. We often hear the phrase “as long as it doesn’t harm anyone else”. Things may not directly affect anyone else, but sin has a much more pervasive effect, beyond the immediate action. So Achan was stoned to death, as was his whole family and animals, or at least it seems that was what happened. Then the Lord’s anger was abated.