From 49a4613d94d8e500e5bd3c259693fb5ccec4612e Mon Sep 17 00:00:00 2001 From: faketruth Date: Wed, 22 Aug 2012 23:05:12 +0000 Subject: Added a RateCompareString function to StringUtils Created a preprocessor template (define) for DoWith* functions Exported cWorld::FindAndDoWithPlayer(), cRoot::FindAndDoWithPlayer() and cRoot::ForEachPlayer() to Lua Added a function FindAndDoWithPlayer to cRoot and cWorld. It takes a part of a player name and finds a single player based on that. Fixed Core's MOTD to contain the correct URL to the MCServer site Fixed Core /kick command Fixed Core's WebAdmin kick git-svn-id: http://mc-server.googlecode.com/svn/trunk@779 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- MCServer/Plugins/Core/web_playerlist.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'MCServer/Plugins/Core/web_playerlist.lua') 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 .. "

" .. KickPlayerName .. " has been kicked from the game!

" + end + end + if( World:DoWithPlayer( KickPlayerName, FoundPlayerCallback ) == false ) then Content = Content .. "

Could not find player " .. KickPlayerName .. " !

" - elseif( Player:GetName() == KickPlayerName ) then - Player:GetClientHandle():Kick("You were kicked from the game!") - Content = Content .. "

" .. KickPlayerName .. " has been kicked from the game!

" end end @@ -25,7 +27,7 @@ function HandleRequest_PlayerList( Request ) Content = Content .. "Kick" Content = Content .. "" end - World:ForEachPlayer( AddPlayerToTable ) + cRoot:Get():ForEachPlayer( AddPlayerToTable ) if( PlayerNum == 0 ) then Content = Content .. "None" -- cgit v1.2.3