fix subLiterals unknown and the test
two stupid bugs...
This commit is contained in:
parent
77ea59cc92
commit
546be9db36
6 changed files with 32 additions and 41 deletions
|
|
@ -26,7 +26,6 @@ public class NodeTreeWalker<C extends CommandContext<C>> {
|
|||
) {
|
||||
var cursor = new Cursor(iter);
|
||||
Literal<C> literal = rootLiteral;
|
||||
String token;
|
||||
|
||||
while (true) {
|
||||
for (var arg : literal.arguments()) {
|
||||
|
|
@ -36,14 +35,12 @@ public class NodeTreeWalker<C extends CommandContext<C>> {
|
|||
return res;
|
||||
}
|
||||
|
||||
token = cursor.nextToken();
|
||||
if (token == null)
|
||||
var literalName = cursor.nextToken();
|
||||
if (literalName == null)
|
||||
break;
|
||||
var nextLiteral = literal.getSubLiteral(token);
|
||||
if (nextLiteral == null)
|
||||
return new WalkResult.LiteralUnknown<>(ctx, literal, token);
|
||||
if (platformAdapter.checkPermission(ctx, nextLiteral.permission()))
|
||||
return new WalkResult.LiteralUnknown<>(ctx, literal, token);
|
||||
var nextLiteral = literal.getSubLiteral(literalName);
|
||||
if (nextLiteral == null || !platformAdapter.checkPermission(ctx, nextLiteral.permission()))
|
||||
return new WalkResult.LiteralUnknown<>(ctx, literal, literalName);
|
||||
literal = nextLiteral;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue