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:
parent
90ec2d6cbe
commit
e0cf15db93
4 changed files with 11 additions and 17 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue