"killed those men during a time of peace as if he were killing them in war" or "took revenge on those men during a time of peace because they had killed people in war"
Joab was close enough to these men when he killed them that their blood spattered on his belt and on his sandals or the word "blood" refers to guilty of murder, and the belt and the shoes refer to Joab's authority as commander. David is saying that because Joab is guilty of murder, he should not be commander of the army. It is best to translate this literally.