diff options
author | madmaxoft <github@xoft.cz> | 2013-08-15 17:18:17 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2013-08-15 17:18:27 +0200 |
commit | 1c2140dd4de149e55ece23b64f845d30d22b6653 (patch) | |
tree | 41c9077deca9dbbd77b510a25b89dd74dd77920d | |
parent | Added Luksor to contributors list. (diff) | |
download | cuberite-1c2140dd4de149e55ece23b64f845d30d22b6653.tar cuberite-1c2140dd4de149e55ece23b64f845d30d22b6653.tar.gz cuberite-1c2140dd4de149e55ece23b64f845d30d22b6653.tar.bz2 cuberite-1c2140dd4de149e55ece23b64f845d30d22b6653.tar.lz cuberite-1c2140dd4de149e55ece23b64f845d30d22b6653.tar.xz cuberite-1c2140dd4de149e55ece23b64f845d30d22b6653.tar.zst cuberite-1c2140dd4de149e55ece23b64f845d30d22b6653.zip |
-rw-r--r-- | MCServer/Plugins/Core/console.lua | 81 |
1 files changed, 74 insertions, 7 deletions
diff --git a/MCServer/Plugins/Core/console.lua b/MCServer/Plugins/Core/console.lua index 669d7c9cb..8ae8cb675 100644 --- a/MCServer/Plugins/Core/console.lua +++ b/MCServer/Plugins/Core/console.lua @@ -21,9 +21,12 @@ function InitConsoleCommands() PluginMgr:BindConsoleCommand("setversion", HandleConsoleVersion, " ~ Sets server version reported to 1.4+ clients"); PluginMgr:BindConsoleCommand("unban", HandleConsoleUnban, " ~ Unbans a player by name"); PluginMgr:BindConsoleCommand("unload", HandleConsoleUnload, " - Unloads all unused chunks"); - end + + + + function HandleConsoleGive(Split) -- Make sure there are a correct number of arguments. @@ -80,9 +83,12 @@ function HandleConsoleGive(Split) end return true - end + + + + function HandleConsoleBan(Split) if (#Split < 2) then return true, "Usage: ban [Player] <Reason>"; @@ -108,6 +114,10 @@ function HandleConsoleBan(Split) return true end + + + + function HandleConsoleUnban(Split) if #Split < 2 then @@ -123,9 +133,12 @@ function HandleConsoleUnban(Split) local Server = cRoot:Get():GetServer() return true, "Unbanned " .. Split[2] - end + + + + function HandleConsoleBanList(Split) if (#Split == 1) then return true, BanListByName(); @@ -138,6 +151,10 @@ function HandleConsoleBanList(Split) return true, "Unknown banlist subcommand"; end + + + + function HandleConsoleHelp(Split) local Commands = {}; -- {index => {"Command", "HelpString"} } local MaxLength = 0; @@ -166,6 +183,10 @@ function HandleConsoleHelp(Split) return true, Out; end + + + + function HandleConsoleList(Split) -- Get a list of all players, one playername per line local Out = ""; @@ -181,6 +202,10 @@ function HandleConsoleList(Split) return true, Out; end + + + + function HandleConsoleListGroups(Split) -- Read the groups.ini file: local GroupsIni = cIniFile("groups.ini"); @@ -201,6 +226,10 @@ function HandleConsoleListGroups(Split) return true, Out; end + + + + function HandleConsoleNumChunks(Split) local Output = {}; local AddNumChunks = function(World) @@ -220,6 +249,10 @@ function HandleConsoleNumChunks(Split) return true, Out; end + + + + function HandleConsolePlayers(Split) local PlayersInWorlds = {}; -- "WorldName" => [players array] local AddToTable = function(Player) @@ -243,6 +276,10 @@ function HandleConsolePlayers(Split) return true, Out; end + + + + function HandleConsoleVersion(Split) if (#Split == 1) then -- Display current version: @@ -256,6 +293,10 @@ function HandleConsoleVersion(Split) return true, "Primary server version is now #" .. Version .. ", " .. cRoot:GetProtocolVersionTextFromInt(Version); end + + + + function HandleConsoleRank(Split) if (Split[2] == nil) or (Split[3] == nil) then return true, "Usage: /rank [Player] [Group]"; @@ -301,20 +342,38 @@ function HandleConsoleRank(Split) return true, Out .. "Player " .. Split[2] .. " was moved to " .. Split[3]; end + + + + function HandleConsoleReload(Split) - Server = cRoot:Get():GetServer(); - Server:SendMessage(cChatColor.Rose .. "[WARNING] " .. cChatColor.White .. "Reloading all plugins!"); + cRoot:Get():ForEachWorld( + function (a_World) + a_World:BroadcastChat(cChatColor.Rose .. "[WARNING] " .. cChatColor.White .. "Reloading all plugins!"); + end + ) cPluginManager:Get():ReloadPlugins(); return true; end + + + + function HandleConsoleSaveAll(Split) - Server = cRoot:Get():GetServer(); - Server:SendMessage(cChatColor.Rose .. "[WARNING] " .. cChatColor.White .. "Saving all chunks!"); + cRoot:Get():ForEachWorld( + function (a_World) + a_World:BroadcastChat(cChatColor.Rose .. "[WARNING] " .. cChatColor.White .. "Saving all chunks!"); + end + ) cRoot:Get():SaveAllChunks(); return true; end + + + + function HandleConsoleSay(Split) table.remove(Split, 1); local Message = ""; @@ -326,6 +385,10 @@ function HandleConsoleSay(Split) return true; end + + + + function HandleConsoleUnload(Split) local UnloadChunks = function(World) World:UnloadUnusedChunks(); @@ -336,3 +399,7 @@ function HandleConsoleUnload(Split) Out = Out .. "Num loaded chunks after: " .. cRoot:Get():GetTotalChunkCount(); return true, Out; end + + + + |