Minecraft – Prevent people from logging off in certain areas

minecraft-bukkitminecraft-java-editionminecraft-java-edition-server

I am currently making a bukkit server. I have trade rooms, however I do not want people to be able to log off inside them, and log in while someone is trading. How can I prevent this?

My idea is to make their characters tp to spawn if they log off in the area. Anyone know a plugin where I can do this? Or how to do it if I can with WorldGuard. Thanks.

Best Answer

You could run a command to teleport them out again when they recognise, but you also could just run a command like /execute @e[type=Player] (x) (y) (z) /(command) onto a NOT gate to run a command that will teleport the other player out of there... I'm thinking put the command block under the trading room, put in something like /tp @e[type=Player,range=5] (x) (y) (z) and make sure that no other player can come within that radius.

Hope this helps!