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

CommandStats are not used when a command sign is right-clicked by non-OPs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 14w29a
    • Minecraft 14w28b
    • None
    • Unconfirmed

      This ticket applies to signs with JSON run_command actions.

      What I expected:
      Right-clicking the sign would run the commands attached to it, and store the results to the given CommandStats objectives.

      What actually happened:
      The sign ran the commands, but stored 0 to CommandStats variables unless I had permission to use cheats (OP on a server). Note that commands which require OP still ran (which is intended, because the signs can only be created/given by OPs). Only the CommandStats were not correctly stored.

      Steps to Reproduce:

      1. Have cheats on or Operator status
      2. Give yourself a sign which uses CommandStats and OP commands (see below for an example).
      3. Place the sign in the world.
      4. Right-click it, and observe that the commands are triggered and results are stored to CommandStats. For the example sign, you must have at least 2 emeralds in your inventory, and you will receive a cooked beef if it works.
      5. Relinquish operator status or turn off cheats
      6. Right-click the sign again. For the example sign, nothing will happen except "store" being set to 0, even if you have emeralds.

      The following command, courtesy of Avstar98, will give you the example sign mentioned above:

      give @p minecraft:sign 1 0 {BlockEntityTag:{CommandStats:{AffectedItemsName:"@p",AffectedItemsObjective:"store"},Text1:"{text:\"Steak\",clickEvent:{action:run_command,value:\"scoreboard players set @p store 0\"}}",Text2:"{text:\"2 Emeralds\",clickEvent:{action:run_command,value:\"clear @p emerald 0 0\"}}",Text3:"{text:\"\",clickEvent:{action:run_command,value:\"clear @p[score_store_min=2] emerald 0 2\"}}",Text4:"{text:\"\",clickEvent:{action:run_command,value:\"give @p[score_store_min=2] cooked_beef 1\"}}"}}
      

            searge [Mojang] Searge (Michael Stoyke)
            wolfiemario WolfieMario
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: