CombatGuard punishes players who quit during a fight.
Hitting another player puts both of you in combat for 30 seconds, with an action bar countdown.
Leave during combat and your whole inventory and armor drop where you logged out, so your opponent can take them.
When you rejoin, your inventory is cleared (so nothing is duplicated) and you're killed.
The punishment is saved in the world, so restarting the server doesn't skip it.
XP is not dropped when you leave.
No setup or commands are needed.