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

help command not suggesting tab completion when executed from other entity

XMLWordPrintable

    • Confirmed

      The bug

      Currently (1.9.1-pre3) running the /help command for other entities using the /execute command prints the help message for the player or command block running the /execute command. However, when doing this there is no TAB completion hint.

      How to reproduce

      1. Run the following command
        /help
        

        You will see the TAB completion hint

      2. Place an ArmorStand
      3. Now execute the /help command from the ArmorStand
        /execute @e[type=ArmorStand,c=1] ~ ~ ~ /help
        

        You will see no TAB completion hint

      The reason

      The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.

      The reason why this happens is because the method net.minecraft.command.CommandHelp.execute(MinecraftServer, ICommandSender, String[]) tests if the sender is a player. As TAB completion now works in command blocks as well, this test should probably be removed.

      /**
       * Callback for when the command is executed
       *  
       * @param server The Minecraft server instance
       * @param sender The source of the command invocation
       * @param args The arguments that were passed
       */
      public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
      {
          if (sender instanceof CommandBlockBaseLogic)
          {
              //...
          }
          else
          {
              //...
      
              // Replaced this
              //if (k == 0 && sender instanceof EntityPlayer)
              if (k == 0)
              {
                  TextComponentTranslation textcomponenttranslation2 = new TextComponentTranslation("commands.help.footer", new Object[0]);
                  textcomponenttranslation2.getChatStyle().setColor(TextFormatting.GREEN);
                  sender.addChatMessage(textcomponenttranslation2);
              }
          }
      }
      

            Excited Maria Lemón
            marcono1234 [Mod] Marcono1234
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: