summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/Core/kick.lua
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-23 01:05:12 +0200
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-23 01:05:12 +0200
commit49a4613d94d8e500e5bd3c259693fb5ccec4612e (patch)
treeea2db28bde16c472f02b6a83651df8cf2fe486a9 /MCServer/Plugins/Core/kick.lua
parentAdded a documentation for block and item handlers (diff)
downloadcuberite-49a4613d94d8e500e5bd3c259693fb5ccec4612e.tar
cuberite-49a4613d94d8e500e5bd3c259693fb5ccec4612e.tar.gz
cuberite-49a4613d94d8e500e5bd3c259693fb5ccec4612e.tar.bz2
cuberite-49a4613d94d8e500e5bd3c259693fb5ccec4612e.tar.lz
cuberite-49a4613d94d8e500e5bd3c259693fb5ccec4612e.tar.xz
cuberite-49a4613d94d8e500e5bd3c259693fb5ccec4612e.tar.zst
cuberite-49a4613d94d8e500e5bd3c259693fb5ccec4612e.zip
Diffstat (limited to 'MCServer/Plugins/Core/kick.lua')
-rw-r--r--MCServer/Plugins/Core/kick.lua28
1 files changed, 15 insertions, 13 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