summaryrefslogtreecommitdiffstats
path: root/source/PluginManager.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-07-31 11:16:11 +0200
committermadmaxoft <github@xoft.cz>2013-07-31 11:16:11 +0200
commite8a907d89e37bf6eeab8e852c8439ae4899cd114 (patch)
treeb32238a03ec0826d2ffc02da946ea5c12fac3e71 /source/PluginManager.cpp
parentTab completion packet is handled and sent. (diff)
downloadcuberite-e8a907d89e37bf6eeab8e852c8439ae4899cd114.tar
cuberite-e8a907d89e37bf6eeab8e852c8439ae4899cd114.tar.gz
cuberite-e8a907d89e37bf6eeab8e852c8439ae4899cd114.tar.bz2
cuberite-e8a907d89e37bf6eeab8e852c8439ae4899cd114.tar.lz
cuberite-e8a907d89e37bf6eeab8e852c8439ae4899cd114.tar.xz
cuberite-e8a907d89e37bf6eeab8e852c8439ae4899cd114.tar.zst
cuberite-e8a907d89e37bf6eeab8e852c8439ae4899cd114.zip
Diffstat (limited to '')
-rw-r--r--source/PluginManager.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/source/PluginManager.cpp b/source/PluginManager.cpp
index 37032f6c3..043390cbc 100644
--- a/source/PluginManager.cpp
+++ b/source/PluginManager.cpp
@@ -1335,14 +1335,22 @@ bool cPluginManager::ExecuteConsoleCommand(const AStringVector & a_Split, cComma
-void cPluginManager::TabCompleteCommand(const AString & a_Text, AStringVector & a_Results)
-{
- // TODO
- // DEBUG:
- LOGWARNING("%s: Not implemented yet!", __FUNCTION__);
- a_Results.push_back(a_Text + "_plgmgr1");
- a_Results.push_back(a_Text + "_plgmgr3");
- a_Results.push_back(a_Text + "_plgmgr2");
+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);
+ }
}