diff options
author | bearbin <bearbin@gmail.com> | 2013-07-27 18:19:22 +0200 |
---|---|---|
committer | bearbin <bearbin@gmail.com> | 2013-07-27 18:19:22 +0200 |
commit | 1d0b57d8abf2297614659e1115b81d569612a402 (patch) | |
tree | df7d0acb85b3ef5c4783f721a83908ddc5130ef7 /MCServer/Plugins/Core/help.lua | |
parent | Merge pull request #7 from tigerw/master (diff) | |
parent | Merge pull request #8 from mc-server/master (diff) | |
download | cuberite-1d0b57d8abf2297614659e1115b81d569612a402.tar cuberite-1d0b57d8abf2297614659e1115b81d569612a402.tar.gz cuberite-1d0b57d8abf2297614659e1115b81d569612a402.tar.bz2 cuberite-1d0b57d8abf2297614659e1115b81d569612a402.tar.lz cuberite-1d0b57d8abf2297614659e1115b81d569612a402.tar.xz cuberite-1d0b57d8abf2297614659e1115b81d569612a402.tar.zst cuberite-1d0b57d8abf2297614659e1115b81d569612a402.zip |
Diffstat (limited to 'MCServer/Plugins/Core/help.lua')
-rw-r--r-- | MCServer/Plugins/Core/help.lua | 79 |
1 files changed, 40 insertions, 39 deletions
diff --git a/MCServer/Plugins/Core/help.lua b/MCServer/Plugins/Core/help.lua index 68cdeca66..339fc054b 100644 --- a/MCServer/Plugins/Core/help.lua +++ b/MCServer/Plugins/Core/help.lua @@ -1,40 +1,41 @@ -function HandleHelpCommand(Split, Player)
- local PluginManager = cRoot:Get():GetPluginManager()
-
- local LinesPerPage = 9;
- local CurrentPage = 1;
- local CurrentLine = 0;
- local PageRequested = 1;
- local Output = {};
-
- if (#Split == 2) then
- PageRequested = tonumber(Split[2]);
- end
-
- local Process = function(Command, Permission, HelpString)
- if not(Player:HasPermission(Permission)) then
- return false;
- end;
- if (HelpString == "") then
- return false;
- end;
-
- CurrentLine = CurrentLine + 1;
- CurrentPage = math.floor(CurrentLine / LinesPerPage) + 1;
- if (CurrentPage ~= PageRequested) then
- return false;
- end;
- table.insert(Output, cChatColor.Blue .. Command .. HelpString);
- end
-
- PluginManager:ForEachCommand(Process);
-
- -- CurrentPage now contains the total number of pages, and Output has the individual help lines to be sent
-
- Player:SendMessage(cChatColor.Purple .. "- All commands - " .. cChatColor.Gold .. "[Page " .. PageRequested .. " / " .. CurrentPage .. "]");
- for idx, msg in ipairs(Output) do
- Player:SendMessage(msg);
- end;
-
- return true
+function HandleHelpCommand(Split, Player) + local PluginManager = cRoot:Get():GetPluginManager() + + local LinesPerPage = 8; + local CurrentPage = 1; + local CurrentLine = 0; + local PageRequested = 1; + local Output = {}; + + if (#Split == 2) then + PageRequested = tonumber(Split[2]); + end + + local Process = function(Command, Permission, HelpString) + if not(Player:HasPermission(Permission)) then + return false; + end; + if (HelpString == "") then + return false; + end; + + CurrentLine = CurrentLine + 1; + CurrentPage = math.floor(CurrentLine / LinesPerPage) + 1; + if (CurrentPage ~= PageRequested) then + return false; + end; + table.insert(Output, cChatColor.Blue .. Command .. HelpString); + end + + PluginManager:ForEachCommand(Process); + + -- CurrentPage now contains the total number of pages, and Output has the individual help lines to be sent + + Player:SendMessage(cChatColor.Purple .. "---------- [COMMANDS HELP " .. cChatColor.Gold .. "(Page " .. PageRequested .. " / " .. CurrentPage .. ")" .. cChatColor.Purple .. "] -----------"); + Player:SendMessage(cChatColor.Purple .. "'-' means no prefix, '~' means a value is required."); + for idx, msg in ipairs(Output) do + Player:SendMessage(msg); + end; + + return true end
\ No newline at end of file |