mojira.dev
MC-2911

Gamerule commands allow parameters other than true/false

When issuing a gamerule command, for example:
/gamerule doFireTick on, the game will accept that "on" parameter without throwing any errors.

This can result into major confusion, since the game will parse anything other than "true" as false.

Expected

  • Throw an error for an incorrect paramter

What happens

  • The game accepts the faulty parameter, yet considers it as false

To reproduce
1. Change a gamerule to anything other than "true/false"
2. Check the gamerule, it will say the exact parameter that was entered
3. Notice that it will be considered as false

Linked issues

Comments 11

See issue MC-2887 for an example of confusion that this issue causes.

also affects pre 1.5 it only accepts the word "TRUE" lower or uppercase mix up doesn't matter, but the only way to turn it on the word 'on' is wrong is the word "true" any other value it will be accepted and be turned false off but will show the value introduced, works on single and multi player.

tried on a flat world, changing to any difficulty, and died on purpose several times wither fall damage or killed by zombies.

way to reproduce and easy to be misleaded into

  • type /gamerule keepInventory

  • shows keepInventory off
    -->this part i thought i could write 'on' due to the game telling me it was 'off'

  • type /gamerule keepInventory on

  • shows keepInventory on
    -->didn't knew the value is still off, seems 'on' and 'off' are just display info not a real value

  • die in anyway

  • inventory droped

worked on win7, lastest java and preMc release at the time of the post, i found out in multiplayer while deep underground killed by cavespiders x.x R.I.P. our loot

The gamerules are parsed with parseBoolean, the only recognized keyword is "true" (in any case):

public static boolean parseBoolean(String s)

Parses the string argument as a boolean. The boolean returned represents the value true if the string argument is not null and is equal, ignoring case, to the string "true".
Example: Boolean.parseBoolean("True") returns true.
Example: Boolean.parseBoolean("yes") returns false.

Is this still a concern in the current Minecraft version 1.6.4 / Launcher version 1.2.5 ? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

Also note that /gamerule doTileDrops 0 works (0 = false) while /gamerule doTileDrops 1 doesn't do anything.

1 more comments

NOT intended. This is about parameters, not value.

Confirmed for 14w18b.

Confirmed for 14w28b

Nice, but when creating a gamerule/scoreboard objective I always put the first word lowercase and the rest capital for example /gamerule spongesAreAmazing true. BTW related to MC-65113.

Hey, I liked that "feature" and it's now fixed... 😛
/gamerule mobGriefing nope

Mustek

michael

Confirmed

Minecraft 1.4.4, Minecraft 1.4.7, Snapshot 13w06a, Minecraft 1.5, Snapshot 13w11a, ..., Minecraft 14w17a, Minecraft 14w18b, Minecraft 1.7.10, Minecraft 14w28a, Minecraft 14w28b

Minecraft 14w32a

Retrieved