brigadier-ts
brigadier-ts copied to clipboard
Execution fails for a command tree with adjacent branches
With the following command tree, only the first branch with a
and b
arguments works correctly:
dispatcher.register(literal('foo')
.then(argument('a', new FloatArgumentType())
.then(argument('b', new FloatArgumentType())
.executes(ctx => ctx.get('a') + ctx.get('b'))))
.then(argument("c", new FloatArgumentType())
.executes(ctx => ctx.get('c')))
);
In other words:
-
foo 1 2
succeeds -
foo 1
fails with messageUnknown Command at position 5: foo 1<--[HERE]
The argument type seems to not affect the issue. Switching the branches around such that the first branch only has the c
argument causes the second branch with a
and b
arguments to fail.