1
0

Fixed possible confusion.

If a command handler gets an error then the player will receive an unknown command error. This can be confusing for players.
This commit is contained in:
STRWarrior 2014-06-17 13:27:04 +02:00
parent 6b503b45a0
commit 8928310fd8
2 changed files with 8 additions and 2 deletions

View File

@ -1356,7 +1356,13 @@ bool cPluginManager::HandleCommand(cPlayer * a_Player, const AString & a_Command
ASSERT(cmd->second.m_Plugin != NULL);
return cmd->second.m_Plugin->HandleCommand(Split, a_Player);
if (!cmd->second.m_Plugin->HandleCommand(Split, a_Player))
{
a_Player->SendMessageFailure(Printf("Something went wrong while executing command \"%s\"", Split[0].c_str()));
return true; // The command handler was found and executed, so we return true.
}
return true;
}

View File

@ -321,7 +321,7 @@ private:
/** Adds the plugin into the internal list of plugins and initializes it. If initialization fails, the plugin is removed again. */
bool AddPlugin(cPlugin * a_Plugin);
/** Tries to match a_Command to the internal table of commands, if a match is found, the corresponding plugin is called. Returns true if the command is handled. */
/** Tries to match a_Command to the internal table of commands, if a match is found, the corresponding plugin is called. Returns true if the command is executed. */
bool HandleCommand(cPlayer * a_Player, const AString & a_Command, bool a_ShouldCheckPermissions, bool & a_WasCommandForbidden);
bool HandleCommand(cPlayer * a_Player, const AString & a_Command, bool a_ShouldCheckPermissions)
{