c=X
will truncate the list down to X
players. For example, if @a
finds Alice, Bob and Carol, then @a[c=2]
will find Alice and Bob.
The selector will still be successful so long as it finds at least one player, even though there were more players. This is similar to how other selector arguments such as x=0,y=0,z=0,r=100
only need one player to match to be successful, not every player on the server.
To determine if there is exactly one player within a certain radius, you can use a command blocks' SuccessCount
, which with /testfor
will store how many players were detected. You can thus test when this is exactly one with a second command block, and have the conditions running off of that:
Commands:
1. /testfor @a[x=0,y=0,z=0,r=100]
2. /testforblock ~1 ~ ~ command_block * {SuccessCount:1}
3. commands you want to activate when exactly one player is within the radius
Keep in mind that you'll need to change command_block
to match the type of command block the one with testfor
in is (e.g: chain_command_block
or repeating_command block
), and ~1 ~ ~
to match where it is.