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
discovered while testing 1
is duplicated by 4
Comments 11
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 valuedie 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.
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.
See issue MC-2887 for an example of confusion that this issue causes.