1
0
cuberite-2a/MCServer/Plugins/Core/kick.lua
faketruth 49a4613d94 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
2012-08-22 23:05:12 +00:00

29 lines
849 B
Lua

function HandleKickCommand( Split, Player )
if( #Split < 2 ) then
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 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
if( cRoot:Get():FindAndDoWithPlayer( Split[2], FoundPlayerCallback ) == false ) then
Player:SendMessage( cChatColor.Green .. "Could not find player " .. Split[2] )
return true
end
return true
end