[MC-10880] Comma or other symbol after @ selector does not work with command blocks Created: 03/Mar/13  Updated: 16/Nov/17  Resolved: 16/Nov/17

Status: Resolved
Project: Minecraft: Java Edition
Component/s: None
Affects Version/s: Snapshot 13w09a, Snapshot 13w09b, Snapshot 13w09c, Snapshot 13w10a, Minecraft 1.5, Snapshot 13w11a, Minecraft 1.7.4, Minecraft 14w05b, Minecraft 14w08a, Minecraft 14w18a, Minecraft 14w21b, Minecraft 1.8, Minecraft 1.8.1-pre3, Minecraft 1.8.8, Minecraft 15w38a, Minecraft 1.10.2, Minecraft 16w35a, Minecraft 16w42a, Minecraft 16w43a, Minecraft 1.12.2
Fix Version/s: Minecraft 17w46a

Type: Bug
Reporter: Bradley Paul Gizzi Assignee: Unassigned
Resolution: Fixed Votes: 9
Labels: selector
Environment:

Windows XP, JRE7
Windows 10, JRE8


Attachments: PNG File 2013-03-03_14.39.46.png     PNG File 2013-03-03_14.39.47.png    
Issue Links:
Duplicate
is duplicated by MC-9895 The command block only says the playe... Resolved
is duplicated by MC-9898 Comma or other symbol after @ selecto... Resolved
is duplicated by MC-12049 Commandblock, Playervariable and punc... Resolved
is duplicated by MC-18653 /say and /w command bug Resolved
CHK:
Confirmation Status: Confirmed

 Description   

@p and @a won't list usernames

What I expected to happen was...:

Command Block: /say @p, You are not allowed to access this area!

What actually happened was...:
[@] @p, you are not allowed to access this area!

Steps to Reproduce:
1. Get a command block (/give username 137)
2. Type in the command block /say @p, somat here
3. Power with redstone

Result:

[@] @p, somat here



 Comments   
Comment by Bradley Paul Gizzi [ 16/Sep/15 ]

Updated this, been 2 years nearly since it was reported, minor issue but would be nice to have fixed.

Comment by [Mojang] Nathan Adams [ 25/Oct/14 ]

This may be fixed later when we use my Brigadier command library, but no promises so I'm going to leave it open until it actually is fixed

Comment by The.Modificator [ 25/Oct/14 ]

I'd like to add that /say Test, @p[]! does also not work (as discussed above). However, I'd still vote to close this ticket because whenever someone wants to accomplish something like this, he/she can easily use /tellraw now. So there is no need for changing the current behavior.

Comment by Galaxy_2Alex [ 25/Oct/14 ]

Reopened, thanks,

Comment by The.Modificator [ 25/Oct/14 ]

Well, yeah: /say @p is there. Hello, @p! @p, What's up? will still result in the chat line The.Modificator is there. Hello, @p! @p, what's up?, so the behavior is not changed.

However, since the command /tellraw was introduced a few versions ago, there is a wordaround for this now.

Comment by Galaxy_2Alex [ 25/Oct/14 ]

Is this still a concern in the current Minecraft version 1.8.1 Prerelease 3 / Launcher version 1.5.3 or later? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

Comment by TrazLander [ 16/Jul/14 ]

I guess this might not get fixed now that you can do most of this with /tellraw and JSON

Comment by Marcono1234 [ 10/Jun/14 ]

Confirmed for 14w21b

Comment by qmagnet [ 30/Apr/14 ]

Confirmed for 14w18a but you should be using tellraw now

Comment by Itouch2 [ 23/Feb/14 ]

Confirmed for 08a

Comment by WolfieMario [ 14/Sep/13 ]

Has this been abandoned?

I can confirm this bug for 13w37b. Can somebody please update the Affects Versions tag? It happens whether you use @p or @p[].

Comment by Bradley Paul Gizzi [ 04/Mar/13 ]

So your implementing this as a bugfix? Cool, never thought you'd fix this as it is the comma. @p, hi
Do some tests and you'll see.
Could you not just replace every @p or make it work at least? Because using it like this: /say @p , Hi
Just doesnt look good.

P.S. I didn't mark private. I marked it as public. A mod must of marked private.

Comment by [Mojang] Nathan Adams [ 04/Mar/13 ]

We'll still allow @p as it does now, where it's the entire word. It would probably need @p[] as you suggested for detection within a word.

Comment by The.Modificator [ 04/Mar/13 ]

Sounds great! So should map makers start using @p[] in their maps instead of only @p from now on? (Just asking to ensure forward-compatibility.)

Comment by [Mojang] Nathan Adams [ 04/Mar/13 ]

Yes it would, and that's what we will try to do.

Comment by The.Modificator [ 04/Mar/13 ]

Wouldn't the syntax @p[] be easily parsable as tokens? I'm thinking about something like this (in EBNF):

chat_line = { player_selector | other_character };
player_selector = "@" (player_selector_type) "[" [ player_selector_options ] "]";
player_selector_type = "a" | "p" | "r"
player_selector_options = player_selector_option [ { "," player_selector_option } ];
player_selector_option = ("r" | "m" | ...) "=" ...

other_character would have to be set to some kind of fallback. And what I wrote for player_selector_option is just a sketch.

I just edited the EBNF. This is what the EBNF looked like before my edit:

chat_line = { player_selector | other_character };
player_selector = "@" ("a" | "p" | "r") "[" [ player_selector_options ] "]";
player_selector_options = player_selector_option [ { "," player_selector_option } ];
player_selector_option = ("r" | "m" | ...) "=" ...
Comment by [Mojang] Nathan Adams [ 04/Mar/13 ]

Will have to fix after 1.5 as the player selector should use a token based system, and not regex. Too scary to do too close to 1.5!

Comment by FireHunterX [ 04/Mar/13 ]

If punctuation is added after the @p or @a without a space between, the function of @p is ignored and it is not recognized as a console action. This is very frequently seen with chat bots and other text-based things that involve changing outputs.

Comment by The.Modificator [ 04/Mar/13 ]

IMO a good resolution for this would be allowing this syntax:

say Well done, @p[]!

Using such a character sequence pretty much ensures that those characters should be interpreted as a placeholder, not part of a normal chat line.

Just doing a normal search-and-replace for just "@p" won't work as it breaks "normal" chat lines like this:

say @carl_d: Please bring some food. @peter_h: Please bring the arrows!

This would then output: "@carl_d: Please bring some food. The.Modificatoreter_h: Please bring the arrows!" The character sequence "@p[]" shouldn't appear in normal chat though. (Except for very fancy smileys.)

Comment by The.Modificator [ 04/Mar/13 ]

I think the problem is caused by the comma after @p. I did a similar thing with an exclamation mark like this:

say Well done, @p!

This will output: "Well done, @p!"

It only worked when I added a space after @p like this:

say Well done, @p !

This will output: "Well done, The.Modificator !"

EDIT: Just tested it with the comma. Same behavior here.

Comment by [Mojang] Jeb (Jens Bergensten) [ 04/Mar/13 ]

@p is case sensitive, maybe that's the problem?

Comment by Tails [ 03/Mar/13 ]

Please do not mark issues as private, unless your bug report is a security issue containing information that may compromise your server/client.

Comment by Kumasasa [ 03/Mar/13 ]

Cannot reproduce.
@p is replaced by player name

Generated at Sun Jan 12 12:25:49 UTC 2025 using Jira 9.12.2#9120002-sha1:301bf498dd45d800842af0b84230f1bb58606c13.