A "node" is an element that looks like this:
{
"type": "root|literal|argument",
"parser": "", // only applicable if type is argument
"properties": {}, // only applicable if type is argument, defaults to empty object
"executable": true, // default if not specified is false, meaning it isn't a runnable command by itself
"children": {}, // default if not specified is {}, meaning no children
"redirect": [] // default if not specified is null, meaning no redirect
}
A redirect
is a path to another node in the tree. ["foo", "bar", "baz"]
means "find the child named foo
of the root, then the child of that named bar
, then the child of that named baz
".
Every element of children
is another node, which itself may have more children.
A literal
type means "I expect the literal name of this node", and has no properties
.
An argument
type means it's dynamically parsed, using parser
(and any optional properties
)
@justblender this is a generated file that the game doesn't read in any way, intended for 3rd party editors to use to see our command tree. Can you explain why this is a bad format for that, and how it can look better?
@ryantheleach quoted string are
"type": "brigadier:string", "properties": {"type": "phrase"}
. Word means "up to the next space", phrase is "an unquoted word or quoted string", and greedy is "everything from this point to the end of input".Regex string is on my todo list, the other ones I'm not sure I can guarantee right now.