summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/Core/kick.lua
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-11 16:30:28 +0200
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-11 16:30:28 +0200
commit0433de9955d500c6ab8b6819e4f64c06a7317f98 (patch)
tree9417d745cf3b65301718ba5584fff983140a3ae2 /MCServer/Plugins/Core/kick.lua
parentCan now send usertypes (cPlayer, cEntity, cCuboid) along with a plugin:Call() (diff)
downloadcuberite-0433de9955d500c6ab8b6819e4f64c06a7317f98.tar
cuberite-0433de9955d500c6ab8b6819e4f64c06a7317f98.tar.gz
cuberite-0433de9955d500c6ab8b6819e4f64c06a7317f98.tar.bz2
cuberite-0433de9955d500c6ab8b6819e4f64c06a7317f98.tar.lz
cuberite-0433de9955d500c6ab8b6819e4f64c06a7317f98.tar.xz
cuberite-0433de9955d500c6ab8b6819e4f64c06a7317f98.tar.zst
cuberite-0433de9955d500c6ab8b6819e4f64c06a7317f98.zip
Diffstat (limited to 'MCServer/Plugins/Core/kick.lua')
-rw-r--r--MCServer/Plugins/Core/kick.lua37
1 files changed, 25 insertions, 12 deletions
diff --git a/MCServer/Plugins/Core/kick.lua b/MCServer/Plugins/Core/kick.lua
index ce8bd7a31..5004c8c2f 100644
--- a/MCServer/Plugins/Core/kick.lua
+++ b/MCServer/Plugins/Core/kick.lua
@@ -4,26 +4,39 @@ function HandleKickCommand( Split, Player )
return true
end
+ local Reason = "You have been kicked"
+ if( #Split > 2 ) then
+ Reason = table.concat(Split, " ", 3)
+ end
+
+ if( KickPlayer( Split[2], Reason ) == false ) then
+ Player:SendMessage( cChatColor.Green .. "Could not find player " .. Split[2] )
+ end
+
+ return true
+end
+
+
+function KickPlayer( PlayerName, Reason )
+ local RealName = ""
local FoundPlayerCallback = function( OtherPlayer )
- local Reason = "You have been kicked"
- if( #Split > 2 ) then
- Reason = table.concat(Split, " ", 3)
+ if( Reason == nil ) then
+ Reason = "You have been kicked"
end
+
+ RealName = OtherPlayer:GetName()
local Server = cRoot:Get():GetServer()
- LOGINFO( Player:GetName() .. " is kicking " .. OtherPlayer:GetName() .. " ( "..Reason..") " )
- Server:SendMessage( "Kicking " .. OtherPlayer:GetName() )
+ LOGINFO( "'" .. RealName .. "' is being kicked for ( "..Reason..") " )
+ Server:SendMessage( "Kicking " .. RealName )
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
+ if( cRoot:Get():FindAndDoWithPlayer( PlayerName, FoundPlayerCallback ) == false ) then
+ return false -- could not find player
end
-
-
-
- return true
+
+ return true, RealName -- player should be kicked now
end \ No newline at end of file