Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-113967

Command /me does not resolve selectors if used by operator

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Awaiting Response
    • None
    • Minecraft 1.11.2, Minecraft 17w06a, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 17w43a, Minecraft 17w43b, Minecraft 17w45b, Minecraft 17w46a, Minecraft 17w47a, Minecraft 17w47b, Minecraft 17w48a, Minecraft 18w03b, Minecraft 1.13, Minecraft 18w30b, Minecraft 1.13.2, Minecraft 19w08b, Minecraft 19w09a, 20w46a, 20w49a, 20w51a, 21w03a
    • Confirmed
    • (Unassigned)

      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.

      Example code
      public static ITextComponent getChatComponentFromNthArgIfCanUseSelector(ICommandSender sender, String[] args, int index) throws PlayerNotFoundException, CommandException {
          return getChatComponentFromNthArg(sender, args, index, sender.canUseCommand(1, ""));
      }
      

        1. screenshot.png
          44 kB
          [Mod] Michael Wobst

            Unassigned Unassigned
            marcono1234 Marcono1234
            Votes:
            4 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: