Mojira Archive
MC-174587

Greedy strings cannot contain trailing spaces in a function

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