Skip to content

Commit

Permalink
Removed the console "help" and "reload" commands.
Browse files Browse the repository at this point in the history
They are implemented directly in MCServer, so they are not needed in the Core.
  • Loading branch information
madmaxoft committed Nov 13, 2013
1 parent de53a60 commit 9ec55bc
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions console.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ function InitConsoleCommands()
PluginMgr:BindConsoleCommand("banlist ips", HandleConsoleBanList, " - Lists all players banned by IP")
PluginMgr:BindConsoleCommand("banlist", HandleConsoleBanList, " - Lists all players banned by name")
PluginMgr:BindConsoleCommand("getversion", HandleConsoleVersion, " - Gets server version reported to 1.4+ clients")
PluginMgr:BindConsoleCommand("help", HandleConsoleHelp, " - Lists all commands")
PluginMgr:BindConsoleCommand("give", HandleConsoleGive, " ~ Gives items to the specified player.")
PluginMgr:BindConsoleCommand("kick", HandleConsoleKick, " ~ Kicks a player by name")
PluginMgr:BindConsoleCommand("list", HandleConsoleList, " - Lists all players in a machine-readable format")
PluginMgr:BindConsoleCommand("listgroups", HandleConsoleListGroups, " - Shows a list of all the groups")
PluginMgr:BindConsoleCommand("numchunks", HandleConsoleNumChunks, " - Shows number of chunks currently loaded")
PluginMgr:BindConsoleCommand("players", HandleConsolePlayers, " - Lists all connected players")
PluginMgr:BindConsoleCommand("rank", HandleConsoleRank, " ~ Add a player to a group")
PluginMgr:BindConsoleCommand("reload", HandleConsoleReload, " - Reloads all plugins")
PluginMgr:BindConsoleCommand("save-all", HandleConsoleSaveAll, " - Saves all chunks")
PluginMgr:BindConsoleCommand("say", HandleConsoleSay, " ~ Sends a chat message to all players")
PluginMgr:BindConsoleCommand("setversion", HandleConsoleVersion, " ~ Sets server version reported to 1.4+ clients")
Expand Down Expand Up @@ -162,34 +160,6 @@ function HandleConsoleBanList(Split)
return true, "Unknown banlist subcommand"
end

function HandleConsoleHelp(Split)
local Commands = {} -- {index => {"Command", "HelpString"} }
local MaxLength = 0
local AddToTable = function(Command, HelpString)
table.insert(Commands, { Command, HelpString })
local CmdLen = Command:len()
if (CmdLen > MaxLength) then
MaxLength = CmdLen
end
end

cPluginManager:Get():ForEachConsoleCommand(AddToTable)

-- Sort the table:
local CompareCommands = function(a, b)
return a[1] < b[1] -- compare command strings
end
table.sort(Commands, CompareCommands)

local Out = ""
Out = "'-' denotes no prefix, '~' denotes that a value is required.\n"
for i, Command in ipairs(Commands) do
Out = Out .. Command[1] .. string.rep(" ", MaxLength - Command[1]:len()) -- Align to a table
Out = Out .. Command[2] .. "\n"
end
return true, Out
end

function HandleConsoleList(Split)
-- Get a list of all players, one playername per line
local Out = ""
Expand Down Expand Up @@ -323,14 +293,6 @@ function HandleConsoleRank(Split)
return true, Out .. "Player " .. Split[2] .. " was moved to " .. Split[3]
end

function HandleConsoleReload(Split)

cRoot:Get():BroadcastChat(cChatColor.Rose .. "[WARNING] " .. cChatColor.White .. "Reloading all plugins!")
LOGINFO("Reloading all plugins!")
cRoot:Get():GetPluginManager():ReloadPlugins()
return true
end

function HandleConsoleSaveAll(Split)

cRoot:Get():BroadcastChat(cChatColor.Rose .. "[WARNING] " .. cChatColor.White .. "Saving all chunks!")
Expand Down

0 comments on commit 9ec55bc

Please sign in to comment.