summaryrefslogtreecommitdiffstats
path: root/MCServer
diff options
context:
space:
mode:
Diffstat (limited to 'MCServer')
-rw-r--r--MCServer/Plugins/Core/kick.lua28
-rw-r--r--MCServer/Plugins/Core/main.lua2
-rw-r--r--MCServer/Plugins/Core/motd.lua2
-rw-r--r--MCServer/Plugins/Core/web_playerlist.lua14
4 files changed, 25 insertions, 21 deletions
diff --git a/MCServer/Plugins/Core/kick.lua b/MCServer/Plugins/Core/kick.lua
index ff4f8a705..ce8bd7a31 100644
--- a/MCServer/Plugins/Core/kick.lua
+++ b/MCServer/Plugins/Core/kick.lua
@@ -3,25 +3,27 @@ function HandleKickCommand( Split, Player )
Player:SendMessage( cChatColor.Green .. "Usage: /kick [Player] <Reason>" )
return true
end
+
+ local FoundPlayerCallback = function( OtherPlayer )
+ local Reason = "You have been kicked"
+ if( #Split > 2 ) then
+ Reason = table.concat(Split, " ", 3)
+ end
- local World = Player:GetWorld()
- local OtherPlayer = World:GetPlayer( Split[2] )
- if( OtherPlayer == nil ) then
- Player:SendMessage( cChatColor.Green .. "Could not find player " .. Split[2] )
- return true
+ local Server = cRoot:Get():GetServer()
+ LOGINFO( Player:GetName() .. " is kicking " .. OtherPlayer:GetName() .. " ( "..Reason..") " )
+ Server:SendMessage( "Kicking " .. OtherPlayer:GetName() )
+
+ local ClientHandle = OtherPlayer:GetClientHandle()
+ ClientHandle:Kick( Reason )
end
- local Reason = "You have been kicked"
- if( #Split > 2 ) then
- Reason = table.concat(Split, " ", 3)
+ if( cRoot:Get():FindAndDoWithPlayer( Split[2], FoundPlayerCallback ) == false ) then
+ Player:SendMessage( cChatColor.Green .. "Could not find player " .. Split[2] )
+ return true
end
- local Server = cRoot:Get():GetServer()
- LOGINFO( Player:GetName() .. " is kicking " .. OtherPlayer:GetName() .. " ( "..Reason..") " )
- Server:SendMessage( "Kicking " .. OtherPlayer:GetName() )
- local ClientHandle = OtherPlayer:GetClientHandle()
- ClientHandle:Kick( Reason )
return true
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/main.lua b/MCServer/Plugins/Core/main.lua
index c813f19f7..6b4af5533 100644
--- a/MCServer/Plugins/Core/main.lua
+++ b/MCServer/Plugins/Core/main.lua
@@ -22,7 +22,7 @@ function Initialize( Plugin )
PluginManager:AddHook(Plugin, cPluginManager.HOOK_BLOCK_DIG)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_KILLED)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_CRAFTING_NO_RECIPE)
- PluginManager:AddHook(Plugin, cPluginManager.E_PLUGIN_CHAT) -- used in web_chat.lua
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT) -- used in web_chat.lua
Plugin:AddCommand("/help", " - [Page] Show this message", "core.help")
Plugin:AddCommand("/pluginlist", " - Show list of plugins", "core.pluginlist")
diff --git a/MCServer/Plugins/Core/motd.lua b/MCServer/Plugins/Core/motd.lua
index 49cdcecad..69f3ee245 100644
--- a/MCServer/Plugins/Core/motd.lua
+++ b/MCServer/Plugins/Core/motd.lua
@@ -5,6 +5,6 @@ end
function ShowMOTDTo( Player )
Player:SendMessage( cChatColor.Gold .. "Welcome to the MCServer test server!" );
- Player:SendMessage( cChatColor.Gold .. "http://mcserver.ae-c.net/" );
+ Player:SendMessage( cChatColor.Gold .. "http://www.mcserver.org/" );
Player:SendMessage( cChatColor.Gold .. "Type /help for all commands" );
end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/web_playerlist.lua b/MCServer/Plugins/Core/web_playerlist.lua
index b7e48cc3f..c042c0072 100644
--- a/MCServer/Plugins/Core/web_playerlist.lua
+++ b/MCServer/Plugins/Core/web_playerlist.lua
@@ -4,12 +4,14 @@ function HandleRequest_PlayerList( Request )
if( Request.Params["playerlist-kick"] ~= nil ) then
local KickPlayerName = Request.Params["playerlist-kick"]
- local Player = World:GetPlayer( KickPlayerName )
- if( Player == nil ) then
+ local FoundPlayerCallback = function( Player )
+ if( Player:GetName() == KickPlayerName ) then
+ Player:GetClientHandle():Kick("You were kicked from the game!")
+ Content = Content .. "<p>" .. KickPlayerName .. " has been kicked from the game!</p>"
+ end
+ end
+ if( World:DoWithPlayer( KickPlayerName, FoundPlayerCallback ) == false ) then
Content = Content .. "<p>Could not find player " .. KickPlayerName .. " !</p>"
- elseif( Player:GetName() == KickPlayerName ) then
- Player:GetClientHandle():Kick("You were kicked from the game!")
- Content = Content .. "<p>" .. KickPlayerName .. " has been kicked from the game!</p>"
end
end
@@ -25,7 +27,7 @@ function HandleRequest_PlayerList( Request )
Content = Content .. "<td><a href='?playerlist-kick=" .. Player:GetName() .. "'>Kick</a></td>"
Content = Content .. "</tr>"
end
- World:ForEachPlayer( AddPlayerToTable )
+ cRoot:Get():ForEachPlayer( AddPlayerToTable )
if( PlayerNum == 0 ) then
Content = Content .. "<tr><td>None</td></tr>"