diff options
Diffstat (limited to 'MCServer/Plugins/Core')
-rw-r--r-- | MCServer/Plugins/Core/console.lua | 81 | ||||
-rw-r--r-- | MCServer/Plugins/Core/onjoinleave.lua | 37 |
2 files changed, 92 insertions, 26 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 + + + + diff --git a/MCServer/Plugins/Core/onjoinleave.lua b/MCServer/Plugins/Core/onjoinleave.lua index c794aaf94..cd0ead4fc 100644 --- a/MCServer/Plugins/Core/onjoinleave.lua +++ b/MCServer/Plugins/Core/onjoinleave.lua @@ -1,24 +1,23 @@ + + + + + function OnPlayerJoined(Player) - --if( BannedPlayersIni:GetValueB("Banned", Player:GetName(), false) == true ) then - -- LOGINFO( Player:GetName() .. " tried to join, but is banned!" ) - -- KickPlayer(Player:GetName(), cChatColor.Red .. "You are banned!" ) - -- return true - --elseif( WhiteListIni:GetValueB("WhiteListSettings", "WhiteListOn", false ) == true ) then - -- if( WhiteListIni:GetValueB("WhiteList", Player:GetName(), false ) == false ) then - -- LOGINFO( Player:GetName() .. " tried to join, but is not whitelisted!" ) - -- KickPlayer(Player:GetName(), cChatColor.Red .. "You are not whitelisted!" ) - -- end - --else - ShowMOTDTo( Player ) - local Server = cRoot:Get():GetServer() - Server:SendMessage(cChatColor.Yellow .. "[JOIN] " .. cChatColor.White .. Player:GetName() .. " has joined the game" ) - return false - --end + ShowMOTDTo(Player) + Player:GetWorld():BroadcastChat(cChatColor.Yellow .. "[JOIN] " .. cChatColor.White .. Player:GetName() .. " has joined the game") + return false end + + + + function OnDisconnect(Player, Reason) - local Server = cRoot:Get():GetServer() - Server:SendMessage(cChatColor.Yellow .. "[LEAVE] " .. cChatColor.White .. Player:GetName() .. " has left the game" ) - LOG("Player " .. Player:GetName() .. " has left the game.") + Player:GetWorld():BroadcastChat(cChatColor.Yellow .. "[LEAVE] " .. cChatColor.White .. Player:GetName() .. " has left the game") return true -end
\ No newline at end of file +end + + + + |