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

Greedy strings cannot contain trailing spaces in a function

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: 1.15.2, 20w11a, 20w12a, 20w14a, 20w16a, 20w17a, 20w18a, 20w20b, 1.16 Pre-release 5, 1.16.1, 1.16.2 Pre-release 1, 1.16.2, 1.16.3, 1.16.4 Pre-release 1
    • Fix Version/s: None
    • Confirmation Status:
      Confirmed
    • Category:
      Commands

      Description

      The bug

      Because commands in a function are trimmed by java.lang.String#trim, greedy strings cannot contain trailing spaces (U+0000 .. U+0020) in a function.

      Affected commands

      • /advancement grant <targets> only <advancement> <criterion>
      • /advancement revoke <targets> only <advancement> <criterion>
      • /say <message>

      How to reproduce

      1. Install the datapack in Attachments.
      2. /function mc-174587:test

        revoked, the criterion "criterion with a trailing space " is not granted correctly.

      • mc-174587/advancement/test.json
        {
            "criteria": {
                "criterion with a trailing space ": {
                    "trigger": "minecraft:impossible"
                }
            }
        }
      • mc-174587/functions/test.mcfunction
        advancement grant @s only mc-174587:test criterion with a trailing space 
        execute if entity @s[advancements={mc-174587:test=true}] run say granted
        execute if entity @s[advancements={mc-174587:test=false}] run say revoked

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              intsuc intsuc
              Votes:
              2 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                CHK: