misode / brigadier-ts

TypeScript port of Mojang/brigadier
MIT License
18 stars 5 forks source link

Execution fails for a command tree with adjacent branches #17

Open haykam821 opened 1 year ago

haykam821 commented 1 year ago

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:

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.