Fixed the Reload and Save-all console commands.
They were broken by the PerWorldThreads update removing cServer:BroadcastMessage() and cServer:SendMessage()
This commit is contained in:
parent
18fcab06ce
commit
1c2140dd4d
@ -21,9 +21,12 @@ function InitConsoleCommands()
|
|||||||
PluginMgr:BindConsoleCommand("setversion", HandleConsoleVersion, " ~ Sets server version reported to 1.4+ clients");
|
PluginMgr:BindConsoleCommand("setversion", HandleConsoleVersion, " ~ Sets server version reported to 1.4+ clients");
|
||||||
PluginMgr:BindConsoleCommand("unban", HandleConsoleUnban, " ~ Unbans a player by name");
|
PluginMgr:BindConsoleCommand("unban", HandleConsoleUnban, " ~ Unbans a player by name");
|
||||||
PluginMgr:BindConsoleCommand("unload", HandleConsoleUnload, " - Unloads all unused chunks");
|
PluginMgr:BindConsoleCommand("unload", HandleConsoleUnload, " - Unloads all unused chunks");
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function HandleConsoleGive(Split)
|
function HandleConsoleGive(Split)
|
||||||
|
|
||||||
-- Make sure there are a correct number of arguments.
|
-- Make sure there are a correct number of arguments.
|
||||||
@ -80,9 +83,12 @@ function HandleConsoleGive(Split)
|
|||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function HandleConsoleBan(Split)
|
function HandleConsoleBan(Split)
|
||||||
if (#Split < 2) then
|
if (#Split < 2) then
|
||||||
return true, "Usage: ban [Player] <Reason>";
|
return true, "Usage: ban [Player] <Reason>";
|
||||||
@ -108,6 +114,10 @@ function HandleConsoleBan(Split)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function HandleConsoleUnban(Split)
|
function HandleConsoleUnban(Split)
|
||||||
|
|
||||||
if #Split < 2 then
|
if #Split < 2 then
|
||||||
@ -123,9 +133,12 @@ function HandleConsoleUnban(Split)
|
|||||||
|
|
||||||
local Server = cRoot:Get():GetServer()
|
local Server = cRoot:Get():GetServer()
|
||||||
return true, "Unbanned " .. Split[2]
|
return true, "Unbanned " .. Split[2]
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function HandleConsoleBanList(Split)
|
function HandleConsoleBanList(Split)
|
||||||
if (#Split == 1) then
|
if (#Split == 1) then
|
||||||
return true, BanListByName();
|
return true, BanListByName();
|
||||||
@ -138,6 +151,10 @@ function HandleConsoleBanList(Split)
|
|||||||
return true, "Unknown banlist subcommand";
|
return true, "Unknown banlist subcommand";
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function HandleConsoleHelp(Split)
|
function HandleConsoleHelp(Split)
|
||||||
local Commands = {}; -- {index => {"Command", "HelpString"} }
|
local Commands = {}; -- {index => {"Command", "HelpString"} }
|
||||||
local MaxLength = 0;
|
local MaxLength = 0;
|
||||||
@ -166,6 +183,10 @@ function HandleConsoleHelp(Split)
|
|||||||
return true, Out;
|
return true, Out;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function HandleConsoleList(Split)
|
function HandleConsoleList(Split)
|
||||||
-- Get a list of all players, one playername per line
|
-- Get a list of all players, one playername per line
|
||||||
local Out = "";
|
local Out = "";
|
||||||
@ -181,6 +202,10 @@ function HandleConsoleList(Split)
|
|||||||
return true, Out;
|
return true, Out;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function HandleConsoleListGroups(Split)
|
function HandleConsoleListGroups(Split)
|
||||||
-- Read the groups.ini file:
|
-- Read the groups.ini file:
|
||||||
local GroupsIni = cIniFile("groups.ini");
|
local GroupsIni = cIniFile("groups.ini");
|
||||||
@ -201,6 +226,10 @@ function HandleConsoleListGroups(Split)
|
|||||||
return true, Out;
|
return true, Out;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function HandleConsoleNumChunks(Split)
|
function HandleConsoleNumChunks(Split)
|
||||||
local Output = {};
|
local Output = {};
|
||||||
local AddNumChunks = function(World)
|
local AddNumChunks = function(World)
|
||||||
@ -220,6 +249,10 @@ function HandleConsoleNumChunks(Split)
|
|||||||
return true, Out;
|
return true, Out;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function HandleConsolePlayers(Split)
|
function HandleConsolePlayers(Split)
|
||||||
local PlayersInWorlds = {}; -- "WorldName" => [players array]
|
local PlayersInWorlds = {}; -- "WorldName" => [players array]
|
||||||
local AddToTable = function(Player)
|
local AddToTable = function(Player)
|
||||||
@ -243,6 +276,10 @@ function HandleConsolePlayers(Split)
|
|||||||
return true, Out;
|
return true, Out;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function HandleConsoleVersion(Split)
|
function HandleConsoleVersion(Split)
|
||||||
if (#Split == 1) then
|
if (#Split == 1) then
|
||||||
-- Display current version:
|
-- Display current version:
|
||||||
@ -256,6 +293,10 @@ function HandleConsoleVersion(Split)
|
|||||||
return true, "Primary server version is now #" .. Version .. ", " .. cRoot:GetProtocolVersionTextFromInt(Version);
|
return true, "Primary server version is now #" .. Version .. ", " .. cRoot:GetProtocolVersionTextFromInt(Version);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function HandleConsoleRank(Split)
|
function HandleConsoleRank(Split)
|
||||||
if (Split[2] == nil) or (Split[3] == nil) then
|
if (Split[2] == nil) or (Split[3] == nil) then
|
||||||
return true, "Usage: /rank [Player] [Group]";
|
return true, "Usage: /rank [Player] [Group]";
|
||||||
@ -301,20 +342,38 @@ function HandleConsoleRank(Split)
|
|||||||
return true, Out .. "Player " .. Split[2] .. " was moved to " .. Split[3];
|
return true, Out .. "Player " .. Split[2] .. " was moved to " .. Split[3];
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function HandleConsoleReload(Split)
|
function HandleConsoleReload(Split)
|
||||||
Server = cRoot:Get():GetServer();
|
cRoot:Get():ForEachWorld(
|
||||||
Server:SendMessage(cChatColor.Rose .. "[WARNING] " .. cChatColor.White .. "Reloading all plugins!");
|
function (a_World)
|
||||||
|
a_World:BroadcastChat(cChatColor.Rose .. "[WARNING] " .. cChatColor.White .. "Reloading all plugins!");
|
||||||
|
end
|
||||||
|
)
|
||||||
cPluginManager:Get():ReloadPlugins();
|
cPluginManager:Get():ReloadPlugins();
|
||||||
return true;
|
return true;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function HandleConsoleSaveAll(Split)
|
function HandleConsoleSaveAll(Split)
|
||||||
Server = cRoot:Get():GetServer();
|
cRoot:Get():ForEachWorld(
|
||||||
Server:SendMessage(cChatColor.Rose .. "[WARNING] " .. cChatColor.White .. "Saving all chunks!");
|
function (a_World)
|
||||||
|
a_World:BroadcastChat(cChatColor.Rose .. "[WARNING] " .. cChatColor.White .. "Saving all chunks!");
|
||||||
|
end
|
||||||
|
)
|
||||||
cRoot:Get():SaveAllChunks();
|
cRoot:Get():SaveAllChunks();
|
||||||
return true;
|
return true;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function HandleConsoleSay(Split)
|
function HandleConsoleSay(Split)
|
||||||
table.remove(Split, 1);
|
table.remove(Split, 1);
|
||||||
local Message = "";
|
local Message = "";
|
||||||
@ -326,6 +385,10 @@ function HandleConsoleSay(Split)
|
|||||||
return true;
|
return true;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function HandleConsoleUnload(Split)
|
function HandleConsoleUnload(Split)
|
||||||
local UnloadChunks = function(World)
|
local UnloadChunks = function(World)
|
||||||
World:UnloadUnusedChunks();
|
World:UnloadUnusedChunks();
|
||||||
@ -336,3 +399,7 @@ function HandleConsoleUnload(Split)
|
|||||||
Out = Out .. "Num loaded chunks after: " .. cRoot:Get():GetTotalChunkCount();
|
Out = Out .. "Num loaded chunks after: " .. cRoot:Get():GetTotalChunkCount();
|
||||||
return true, Out;
|
return true, Out;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user