diff --git a/sources/Commands/Commands_Feature.uc b/sources/Commands/Commands_Feature.uc index 93ac435..9bc9c20 100644 --- a/sources/Commands/Commands_Feature.uc +++ b/sources/Commands/Commands_Feature.uc @@ -417,6 +417,25 @@ public final function array GetGroupsNames() return emptyResult; } +/** + * Handles user input: finds appropriate command and passes the rest of + * the arguments to it for further processing. + * + * @param input Test that contains user's command input. + * @param callerPlayer Player that caused this command call. + */ +public final function HandleInput(BaseText input, EPlayer callerPlayer) +{ + local Parser wrapper; + + if (input == none) { + return; + } + wrapper = input.Parse(); + HandleInputWith(wrapper, callerPlayer); + wrapper.FreeSelf(); +} + /** * Handles user input: finds appropriate command and passes the rest of * the arguments to it for further processing. @@ -425,7 +444,7 @@ public final function array GetGroupsNames() * contain command's name and it's parameters. * @param callerPlayer Player that caused this command call. */ -public final function HandleInput(Parser parser, EPlayer callerPlayer) +public final function HandleInputWith(Parser parser, EPlayer callerPlayer) { local int i; local bool foundID; @@ -435,10 +454,11 @@ public final function HandleInput(Parser parser, EPlayer callerPlayer) local Command.CallData callData; local MutableText commandName; - if (parser == none) return; - if (!parser.Ok()) return; + if (parser == none) return; + if (callerPlayer == none) return; + if (!parser.Ok()) return; controller = callerPlayer.GetController(); - if (controller == none) return; + if (controller == none) return; steamID = controller.GetPlayerIDHash(); for (i = 0; i < allowedPlayers.length; i += 1) @@ -486,7 +506,7 @@ private function bool HandleCommands( return true; } // Pass input to command feature - HandleInput(parser, sender); + HandleInputWith(parser, sender); parser.FreeSelf(); return false; } @@ -504,7 +524,7 @@ private function HandleMutate(string command, PlayerController sendingPlayer) parser = _.text.ParseString(command); sender = _.players.FromController(sendingPlayer); - HandleInput(parser, sender); + HandleInputWith(parser, sender); sender.FreeSelf(); parser.FreeSelf(); }