Command /me does not resolve selectors if used by operator
The bug
Selectors in the text of the command /me (in previous versions also /tell, /msg and /w) are not resolved when an operator uses the command. They are however resolved when the command sender is not a player like for example an entity, a command block or a sign.
How to reproduce
Use the following command as operator
/me Closest player: @p
Code analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
This feature was probably disabled as a fix for MC-43984, but for all players. This can be solved by having the methods net.minecraft.command.server.CommandEmote.execute(MinecraftServer, ICommandSender, String[]) and net.minecraft.command.server.CommandMessage.execute(MinecraftServer, ICommandSender, String[]) call a method which calls the method net.minecraft.command.CommandBase.getChatComponentFromNthArg(ICommandSender, String[], int, boolean) with the boolean parameter value being if the player can use selectors.
public static ITextComponent getChatComponentFromNthArgIfCanUseSelector(ICommandSender sender, String[] args, int index) throws PlayerNotFoundException, CommandException { return getChatComponentFromNthArg(sender, args, index, sender.canUseCommand(1, "")); }
Linked Issues
Created Issue:
Commands me and tell (msg or w) do not resolve selectors if used by operator
Relates to
MC-43984The bug
Selectors in the text of the commands /me or /tell (/msg or /w) are not resolved when an operator uses the command. They are however resolved when the command sender is not a player like for example an entity, a command block or a sign.
How to reproduce
Use the following command as operator
/me Closest player: @pCode analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
This feature was probably disabled as a fix for
MC-43984, but for all players. This can be solved by having the methods net.minecraft.command.server.CommandEmote.execute(MinecraftServer, ICommandSender, String[]) and net.minecraft.command.server.CommandMessage.execute(MinecraftServer, ICommandSender, String[]) call a method which calls the method net.minecraft.command.CommandBase.getChatComponentFromNthArg(ICommandSender, String[], int, boolean) with the boolean parameter value being if the player can use selectors.Example codepublic static ITextComponent getChatComponentFromNthArgIfCanUseSelector(ICommandSender sender, String[] args, int index) throws PlayerNotFoundException, CommandException { return getChatComponentFromNthArg(sender, args, index, sender.canUseCommand(1, "")); }
relates to
Relates to
MC-43984The bug
Selectors in the text of the commands /me or /tell (/msg or /w) are not resolved when an operator uses the command. They are however resolved when the command sender is not a player like for example an entity, a command block or a sign.
How to reproduce
Use the following command as operator
/me Closest player: @pCode analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
This feature was probably disabled as a fix for
MC-43984, but for all players. This can be solved by having the methods net.minecraft.command.server.CommandEmote.execute(MinecraftServer, ICommandSender, String[]) and net.minecraft.command.server.CommandMessage.execute(MinecraftServer, ICommandSender, String[]) call a method which calls the method net.minecraft.command.CommandBase.getChatComponentFromNthArg(ICommandSender, String[], int, boolean) with the boolean parameter value being if the player can use selectors.Example codepublic static ITextComponent getChatComponentFromNthArgIfCanUseSelector(ICommandSender sender, String[] args, int index) throws PlayerNotFoundException, CommandException { return getChatComponentFromNthArg(sender, args, index, sender.canUseCommand(1, "")); }
The bug
Selectors in the text of the commands /me or /tell
(/msgor/w) are not resolved when an operator uses the command. They are however resolved when the command sender is not a player like for example an entity, a command block or a sign.How to reproduce
Use the following command as operator
/me Closest player: @pCode analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
This feature was probably disabled as a fix for
MC-43984, but for all players. This can be solved by having the methods net.minecraft.command.server.CommandEmote.execute(MinecraftServer, ICommandSender, String[]) and net.minecraft.command.server.CommandMessage.execute(MinecraftServer, ICommandSender, String[]) call a method which calls the method net.minecraft.command.CommandBase.getChatComponentFromNthArg(ICommandSender, String[], int, boolean) with the boolean parameter value being if the player can use selectors.Example codepublic static ITextComponent getChatComponentFromNthArgIfCanUseSelector(ICommandSender sender, String[] args, int index) throws PlayerNotFoundException, CommandException { return getChatComponentFromNthArg(sender, args, index, sender.canUseCommand(1, "")); }The bug
Selectors in the text of the commands /me (in previous versions also /tell, /msg and /w) are not resolved when an operator uses the command. They are however resolved when the command sender is not a player like for example an entity, a command block or a sign.
How to reproduce
Use the following command as operator
/me Closest player: @pCode analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
This feature was probably disabled as a fix for
MC-43984, but for all players. This can be solved by having the methods net.minecraft.command.server.CommandEmote.execute(MinecraftServer, ICommandSender, String[]) and net.minecraft.command.server.CommandMessage.execute(MinecraftServer, ICommandSender, String[]) call a method which calls the method net.minecraft.command.CommandBase.getChatComponentFromNthArg(ICommandSender, String[], int, boolean) with the boolean parameter value being if the player can use selectors.Example codepublic static ITextComponent getChatComponentFromNthArgIfCanUseSelector(ICommandSender sender, String[] args, int index) throws PlayerNotFoundException, CommandException { return getChatComponentFromNthArg(sender, args, index, sender.canUseCommand(1, "")); }
Commands/meand /tell (msg or w)do not resolve selectors if used by operatorCommand /me does not resolve selectors if used by operator
The bug
Selectors in the text of the command
s/me (in previous versions also /tell, /msg and /w) are not resolved when an operator uses the command. They are however resolved when the command sender is not a player like for example an entity, a command block or a sign.How to reproduce
Use the following command as operator
/me Closest player: @pCode analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
This feature was probably disabled as a fix for
MC-43984, but for all players. This can be solved by having the methods net.minecraft.command.server.CommandEmote.execute(MinecraftServer, ICommandSender, String[]) and net.minecraft.command.server.CommandMessage.execute(MinecraftServer, ICommandSender, String[]) call a method which calls the method net.minecraft.command.CommandBase.getChatComponentFromNthArg(ICommandSender, String[], int, boolean) with the boolean parameter value being if the player can use selectors.Example codepublic static ITextComponent getChatComponentFromNthArgIfCanUseSelector(ICommandSender sender, String[] args, int index) throws PlayerNotFoundException, CommandException { return getChatComponentFromNthArg(sender, args, index, sender.canUseCommand(1, "")); }

No longer affects /msg, /tell or /w.
Can confirm in 20w51a.
Can confirm in 21w03a.
Cannot reproduce it in 1.21.1/24w38a. It displays the player's name as expected.
Thank you for your report!
However, this issue has been temporarily closed as Awaiting Response.
Is this still an issue in the latest version? If yes, can you please add it to the affected versions (or mention it if you are not the reporter)?
This ticket will automatically reopen when you reply.