Let's say that someone comes onto your property with the intent to commit a crime. Not only that; let's say that you suspected this person would come to commit a crime, and you created a one-way door that traps them in a room when entered. You essentially set up a non lethal "booby trap".
Is this legal? Perhaps you didn't force them into the trap, but they wondered into it by themselves.