diff options
Diffstat (limited to 'source/PluginManager.cpp')
-rw-r--r-- | source/PluginManager.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/source/PluginManager.cpp b/source/PluginManager.cpp index b7a21a7ea..412200256 100644 --- a/source/PluginManager.cpp +++ b/source/PluginManager.cpp @@ -678,6 +678,27 @@ bool cPluginManager::CallHookPlayerRightClick(cPlayer & a_Player, int a_BlockX, +bool cPluginManager::CallHookPlayerRightClickingEntity(cPlayer & a_Player, cEntity & a_Entity) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_RIGHT_CLICKING_ENTITY); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerRightClickingEntity(a_Player, a_Entity)) + { + return true; + } + } + return false; +} + + + + + bool cPluginManager::CallHookPlayerShooting(cPlayer & a_Player) { HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_SHOOTING); @@ -1335,6 +1356,28 @@ bool cPluginManager::ExecuteConsoleCommand(const AStringVector & a_Split, cComma +void cPluginManager::TabCompleteCommand(const AString & a_Text, AStringVector & a_Results, cPlayer * a_Player) +{ + for (CommandMap::iterator itr = m_Commands.begin(), end = m_Commands.end(); itr != end; ++itr) + { + if (NoCaseCompare(itr->first.substr(0, a_Text.length()), a_Text) != 0) + { + // Command name doesn't match + continue; + } + if ((a_Player != NULL) && !a_Player->HasPermission(itr->second.m_Permission)) + { + // Player doesn't have permission for the command + continue; + } + a_Results.push_back(itr->first); + } +} + + + + + bool cPluginManager::AddPlugin(cPlugin * a_Plugin) { m_Plugins[a_Plugin->GetDirectory()] = a_Plugin; |