diff options
author | STRWarrior <niels.breuker@hotmail.nl> | 2014-07-04 15:07:41 +0200 |
---|---|---|
committer | STRWarrior <niels.breuker@hotmail.nl> | 2014-07-04 15:07:41 +0200 |
commit | 41747f05002821901afc05dd25eb9567eac56eb6 (patch) | |
tree | 8e0ce9fdf7f20899ac01c2a5c2c4f7f98c728a3d | |
parent | Fixed ExecuteCommand description. (diff) | |
download | cuberite-41747f05002821901afc05dd25eb9567eac56eb6.tar cuberite-41747f05002821901afc05dd25eb9567eac56eb6.tar.gz cuberite-41747f05002821901afc05dd25eb9567eac56eb6.tar.bz2 cuberite-41747f05002821901afc05dd25eb9567eac56eb6.tar.lz cuberite-41747f05002821901afc05dd25eb9567eac56eb6.tar.xz cuberite-41747f05002821901afc05dd25eb9567eac56eb6.tar.zst cuberite-41747f05002821901afc05dd25eb9567eac56eb6.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Bindings/PluginManager.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp index 2cd514211..8a6ac26fa 100644 --- a/src/Bindings/PluginManager.cpp +++ b/src/Bindings/PluginManager.cpp @@ -257,9 +257,13 @@ bool cPluginManager::CallHookBlockToPickups( bool cPluginManager::CallHookChat(cPlayer * a_Player, AString & a_Message) { - if (HandleCommand(a_Player, a_Message, true) != crUnknownCommand) // We use HandleCommand as opposed to ExecuteCommand to accomodate the need to the WasCommandForbidden bool + switch (HandleCommand(a_Player, a_Message, true)) { - return true; // Chat message was handled as command + case crExecuted: return true; + case crError: a_Player->SendMessageFailure(Printf("Something went wrong while executing command \"%s\"", a_Message.c_str())); return true; + case crBlocked: return true; // The plugin that blocked the command probably wants to send a message to the player. + case crNoPermission: a_Player->SendMessageFailure(Printf("Forbidden command; insufficient privileges: \"%s\"", a_Message.c_str())); return true; + case crUnknownCommand: break; } // Check if it was a standard command (starts with a slash) @@ -1343,7 +1347,6 @@ cPluginManager::CommandResult cPluginManager::HandleCommand(cPlayer * a_Player, !a_Player->HasPermission(cmd->second.m_Permission) ) { - a_Player->SendMessageFailure(Printf("Forbidden command; insufficient privileges: \"%s\"", Split[0].c_str())); LOGINFO("Player %s tried to execute forbidden command: \"%s\"", a_Player->GetName().c_str(), Split[0].c_str()); return crNoPermission; } @@ -1352,7 +1355,6 @@ cPluginManager::CommandResult cPluginManager::HandleCommand(cPlayer * 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 crError; } |