How to keep players in a specific PEX group from leaving an area (no plugins)?

Right now we have a spawn area surrounded in barrier blocks with minecarts.

As an applicant, you are in adventure mode, and cannot interact with anything.

As a member (once promoted), you can get in the minecart. When you shift to get out, it puts you outside the barrier block (through clever placement of blocks).

My question is - is there a more elegant solution than this?

I thought of command blocks to tp @p outside (which adventure mode applicants wouldn't be able to interact with), but if the applicant is standing on top of the pressure plate when the member comes along and triggers it, the applicant is the closest player.

What alternative is there?

Edit: Just to add - we are a strictly vanilla server and want to use as few plugins as possible. Thanks in advance.


Solution 1:

The letter m is your friend! This selector selects the closest player that is in survival mode:

@p[m=0]

The number is the same as in the /gamemode command: 0 is Survival, 1 Creative, 2 Adventure, 3 Spectator.

But why stop there? You can base your whole "member" system on tags. You can even tag players who aren't online:

/scoreboard players tag <NAME> add member

And then teleport:

/tp @p[tag=member] <x> <y> <z>