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

Commands /me and /tell (msg or w) do not resolve selectors if used by operator

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: 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
    • Fix Version/s: None
    • Confirmation Status:
      Confirmed
    • Category:
      (Unassigned)

      Description

      The 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: @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, ""));
      }
      

        Attachments

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

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                marcono1234 [Mod] Marcono1234
              • Votes:
                3 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  CHK: