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