Fix redirection when the player doesn't have access to a command

This commit is contained in:
themode 2021-03-15 09:05:02 +01:00
parent 3c7a96dc4a
commit 78e12879b4

View File

@ -340,8 +340,8 @@ public final class CommandManager {
final ArgumentQueryResult queryResult = CommandParser.findEligibleArgument(commandQueryResult.command,
commandQueryResult.args, input, false, argument -> true);
if (queryResult == null) {
// Invalid argument, return command node
int commandNode = commandIdentityMap.get(commandQueryResult.command);
// Invalid argument, return command node (default to root)
int commandNode = commandIdentityMap.getOrDefault(commandQueryResult.command, 0);
request.retrieve(commandNode);
continue;
}
@ -354,6 +354,9 @@ public final class CommandManager {
request.retrieve(node);
break;
}
// Unexpected issue, redirect to root
request.retrieve(0);
}
// Pair<CommandName,EnabledTracking>