Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JoshieGemFinder opened this issue Dec 14, 2024 · 0 comments

Comments

@JoshieGemFinder
Copy link

JoshieGemFinder commented Dec 14, 2024

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"
    }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant