mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 01:08:35 +00:00
fix(Scripts/Misc) CanExecuteCommand renamed and moved to be executed for all commands. (#19081)
* Fix CanExecuteCommand only being executed on command failure. * Updated for style guide. * Removed pointless hook call. * Modified the name of the hook to better reflect function and moved the call to trigger for non-existent commands. * Updated to OnTryExecuteCommand because Foe has a special place in my heart. * Forgot to change these 2 areas.
This commit is contained in:
@@ -322,8 +322,12 @@ namespace Acore::Impl::ChatCommands
|
||||
oldTail = newTail;
|
||||
}
|
||||
|
||||
if (!sScriptMgr->OnTryExecuteCommand(handler, cmdStr))
|
||||
return true;
|
||||
|
||||
/* if we matched a command at some point, invoke it */
|
||||
if (cmd)
|
||||
{ /* if we matched a command at some point, invoke it */
|
||||
{
|
||||
handler.SetSentErrorMessage(false);
|
||||
if (cmd->IsInvokerVisible(handler) && cmd->_invoker(&handler, oldTail))
|
||||
{ /* invocation succeeded, log this */
|
||||
@@ -332,11 +336,6 @@ namespace Acore::Impl::ChatCommands
|
||||
}
|
||||
else if (!handler.HasSentErrorMessage()) /* invocation failed, we should show usage */
|
||||
{
|
||||
if (!sScriptMgr->CanExecuteCommand(handler, cmdStr))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
cmd->SendCommandHelp(handler);
|
||||
handler.SetSentErrorMessage(true);
|
||||
}
|
||||
@@ -344,11 +343,6 @@ namespace Acore::Impl::ChatCommands
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!sScriptMgr->CanExecuteCommand(handler, cmdStr))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user