summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/Core/ban.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/ban.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/ban.lua')
-rw-r--r--MCServer/Plugins/Core/ban.lua38
1 files changed, 24 insertions, 14 deletions
diff --git a/MCServer/Plugins/Core/ban.lua b/MCServer/Plugins/Core/ban.lua
index a6a662c3c..a4a4822bd 100644
--- a/MCServer/Plugins/Core/ban.lua
+++ b/MCServer/Plugins/Core/ban.lua
@@ -4,27 +4,37 @@ function HandleBanCommand( Split, Player )
return true
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
- end
-
local Reason = "You have been banned"
if( #Split > 2 ) then
Reason = table.concat(Split, " ", 3)
end
+
+
+ if( BanPlayer(Split[2], Reason) == false ) then
+ Player:SendMessage( cChatColor.Green .. "Could not find player " .. Split[2] )
+ return true
+ end
- local Server = cRoot:Get():GetServer()
- LOGINFO( Player:GetName() .. " is banning " .. OtherPlayer:GetName() .. " ( "..Reason..") " )
- Server:SendMessage( "Banning " .. OtherPlayer:GetName() )
+ return true
+end
- local ClientHandle = OtherPlayer:GetClientHandle()
- ClientHandle:Kick( Reason )
+function BanPlayer( PlayerName, Reason )
+ if( Reason == nil ) then
+ Reason = "You have been banned"
+ end
+
+ local Success, RealName = KickPlayer( PlayerName, Reason )
+ if( Success == false ) then
+ return false
+ end
+
+ LOGINFO( "'" .. RealName .. "' is being banned for ( "..Reason..") " )
- BannedPlayersIni:SetValueB("Banned", OtherPlayer:GetName(), true)
+ local Server = cRoot:Get():GetServer()
+ Server:SendMessage( "Banning " .. RealName )
+
+ BannedPlayersIni:SetValueB("Banned", RealName, true)
BannedPlayersIni:WriteFile()
-
+
return true
end \ No newline at end of file