Skip to content

JSON Arguments

Palm edited this page Oct 17, 2024 · 12 revisions

JSON Arguments

For editing and creating commands directly as JSON, you'll have to write everything out manually. Here is the documentation for how new additions should be formatted.


Main JSON Format

Command data consists of two parts; commands, which defines the command properties, and functions, which define their execution.

{
    "commands": {},
    "functions": {}
}

Command JSON Format

Each command object is defined by a key, which is the name of the command. The object then contains the command attributes.
? - For more information about command attributes, see the wiki page Command Attributes.

Types:

"description" - str | string

"usages" - list[str] | string[]

"aliases" - list[str] | string[]

"permissions" - list[str] | string[]

    "helloworld": {
        "description": "Example command.",
        "usages": ["/helloworld <message: str> <amount: int>"],
        "aliases": ["hello", "hi"],
        "permissions": ["easyas.command.all"],
    }

Executions JSON Format

The functions object contains a list of every command's executions to enact when a command is ran.

Each function object is defined by a key, which is the name of the command. The object then contains the executions.

Each execution includes a type argument (the execution type), and a content argument, which is the data to parse.
? - For more information about executions, see the wiki page Functionality.

Types:

"command" - Executes a set command as the server.

? - If you are using an integration, you can use the name of the custom type to reference it.

    "helloworld": [
        {
            "type": "command",
            "content": "say Hello, {0}!"
        },
        {
            "type": "command",
            "content": "give \"{player}\" diamond {1}"
        }
    ]

Example Configuration

{
    "commands": {
        "helloworld": {
            "description": "Example command.",
            "usages": [
                "/helloworld <message: str> <amount: int>"
            ],
            "aliases": [
                "hello",
                "hi"
            ],
            "permissions": [
                "easyas.command.all"
            ]
        }
    },
    "functions": {
        "helloworld": [
            {
                "type": "command",
                "content": "say Hello, {0}!"
            },
            {
                "type": "command",
                "content": "give \"{player}\" diamond {1}"
            }
        ]
    }
}