If you have a custom one, then you can just set a variable for the player when you put him in jail with your custom command, and delete the variable when he's out. And then for example, if the variable {jail} is true when he does the /spawn command, cancel the event.
You can cancel it like this:
on command "/spawn":
if {jail.%player%} is true:
cancel event
else:
stop