Editing
MinecraftCommands
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==== Target selector variables ==== {| class="floatright wikitable" style="clear:none;margin-left:1em;" |+ Summary of target selector variables ! Variable !! Function |- | <code>@p</code> || nearest player |- | <code>@r</code> || random player |- | <code>@a</code> || all players |- | <code>@e</code> || all entities |} A target selector variable identifies the broad category of targets to select. There are four variables: ; <code>@p</code> : Targets the nearest player. If there are multiple nearest players, caused by them being precisely the same distance away, the player who most recently joined the server is selected. : [[#Target selector arguments|Target selector arguments]] may be used to reduce the set of players from which the nearest player will be selected. For example, <code>@p[team=Red]</code> will target the nearest player on team Red even if there are other players closer. : The <code>c</code> target selector argument can be used to increase the number of nearest players targeted (for example, <code>@p[c=3]</code> will target the three nearest players). When negative, <code>c</code> will reverse the order of targeting (for example, <code>@p[c=-1]</code> will target the ''farthest'' player). ; <code>@r</code> : Targets a random player (or entity with the <code>type</code> target selector argument). : [[#Target selector arguments|Target selector arguments]] may be used to reduce the set of players from which a random player will be targeted. For example, <code>@r[team=Red]</code> will only target a random player from team Red. : The <code>c</code> target selector argument can be used to increase the number of random players targeted. For example, <code>@r[c=3]</code> will target three random players. : When used without the <code>type</code> argument, <code>@r</code> always targets a random player. The <code>type</code> argument can be used to target non-player entities (for example, <code>@r[type=Zombie]</code> will target a random [[zombie]], <code>@r[type=!Player]</code> will target a random non-player entity, <code>@r[type=!Zombie]</code> will target a random non-zombie, etc.). ; <code>@a</code> : Targets all players, including dead players. No other selector will find dead players. : [[#Target selector arguments|Target selector arguments]] may be used to reduce the set of players targeted. For example, <code>@a[team=Red]</code> will only target players on team Red. ; <code>@e</code> : Targets all entities (including players). : [[#Target selector arguments|Target selector arguments]] may be used to reduce the set of entities targeted. For example, <code>@e[type=Cow]</code> will only target cows. <!-- please retain double newline above for section differentiation -->
Summary:
Please note that all contributions to Hegemon Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Hegemon Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
Edit source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information