In Control!

In Control!

74M Downloads

[Enhancement] Allow double underscores in configuration file (for comments)

JoshieGemFinder opened this issue ยท 0 comments

commented

The current JSON parser supports using // to make the comments; however, because the // syntax isn't supported in all JSON parsers, most people prefer using a "__comment" key (As in, "__comment": "...").

Currently, this causes an error when used in InControl configuration files
InControl Error: Invalid keywords for spawn.json: __comment
Example:

[
    {
        "__comment": "Example: Prevent enderman from spawning in the overworld for some reason that might not be obvious",
        "dimension": "minecraft:overworld",
        "mob": "minecraft:enderman",
        "result": "deny"
    }
]

This change would only apply to keys prefixed with one or two underscores, so other invalid keys would still raise errors
Example:

[
    {
        "mob": "minecraft:zombie",

        "comment": "This will raise an error since it's not prefixed with an underscore",

        "__comment_1": "Someone in the process of balancing may add __ to the start of a key to temporarily comment it out",
        "__healthmultiply": 4,
        "healthmultiply": 3,

        "__comment_2": "Because 'when' is misspelled here, you'll still get an error because it doesn't have two underscores to prefix it, this change won't affect that"
        "wehn": "onjoin"
    }
]