summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/Core/help.lua
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-08-13 16:44:29 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-08-13 16:44:29 +0200
commit0ac24a98e4055f791f7dccee89997a7852c865b7 (patch)
treef1c361afa8142dcc1a169404b4f8deccb7dcf6b9 /MCServer/Plugins/Core/help.lua
parentRemoved comments (diff)
parentMerge pull request #84 from tonibm19/patch-2 (diff)
downloadcuberite-0ac24a98e4055f791f7dccee89997a7852c865b7.tar
cuberite-0ac24a98e4055f791f7dccee89997a7852c865b7.tar.gz
cuberite-0ac24a98e4055f791f7dccee89997a7852c865b7.tar.bz2
cuberite-0ac24a98e4055f791f7dccee89997a7852c865b7.tar.lz
cuberite-0ac24a98e4055f791f7dccee89997a7852c865b7.tar.xz
cuberite-0ac24a98e4055f791f7dccee89997a7852c865b7.tar.zst
cuberite-0ac24a98e4055f791f7dccee89997a7852c865b7.zip
Diffstat (limited to 'MCServer/Plugins/Core/help.lua')
-rw-r--r--MCServer/Plugins/Core/help.lua60
1 files changed, 31 insertions, 29 deletions
diff --git a/MCServer/Plugins/Core/help.lua b/MCServer/Plugins/Core/help.lua
index 9ec79e056..fe8c50492 100644
--- a/MCServer/Plugins/Core/help.lua
+++ b/MCServer/Plugins/Core/help.lua
@@ -1,41 +1,43 @@
-function HandleHelpCommand(Split, Player)
+function HandleHelpCommand( Split, Player )
+
local PluginManager = cRoot:Get():GetPluginManager()
-
- local LinesPerPage = 8;
- local CurrentPage = 1;
- local CurrentLine = 0;
- local PageRequested = 1;
- local Output = {};
-
+
+ local LinesPerPage = 8
+ local CurrentPage = 1
+ local CurrentLine = 0
+ local PageRequested = 1
+ local Output = {}
+
if (#Split == 2) then
- PageRequested = tonumber(Split[2]);
+ PageRequested = tonumber( Split[2] )
end
-
- local Process = function(Command, Permission, HelpString)
- if not(Player:HasPermission(Permission)) then
- return false;
- end;
+
+ local Process = function( Command, Permission, HelpString )
+ if not (Player:HasPermission(Permission)) then
+ return false
+ end
if (HelpString == "") then
- return false;
- end;
+ return false
+ end
- CurrentLine = CurrentLine + 1;
- CurrentPage = math.floor(CurrentLine / LinesPerPage) + 1;
+ CurrentLine = CurrentLine + 1
+ CurrentPage = math.floor( CurrentLine / LinesPerPage ) + 1
if (CurrentPage ~= PageRequested) then
- return false;
- end;
- table.insert(Output, cChatColor.Blue .. Command .. HelpString);
+ return false
+ end
+ table.insert( Output, Command .. HelpString )
end
- PluginManager:ForEachCommand(Process);
+ 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;
-
+ SendMessage( Player, "Page " .. PageRequested .. " out of " .. CurrentPage .. "." )
+ SendMessage( Player, "'-' means no prefix, '~' means a value is required." )
+ for idx, msg in ipairs( Output ) do
+ SendMessage( Player, msg )
+ end
+
return true
-end \ No newline at end of file
+
+end