Skip to content
This repository has been archived by the owner on Jun 19, 2020. It is now read-only.

Commit

Permalink
Remove kick and ban broadcast messages
Browse files Browse the repository at this point in the history
  • Loading branch information
vexyl committed Aug 6, 2018
1 parent d318812 commit 8a4efcc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
21 changes: 7 additions & 14 deletions plugins/essentials/ban.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,16 @@ EssentialsPlugin.Ban_BanCommand = function(client, args)
return
end

local message1 = "Banned"
local message2 = "&e" .. client.name .. " has banned " .. name .. " from the server."
local message = "Banned by " .. client.name
local reason = nil

if (args[2] ~= nil) then
reason = table.concat(args, " ", 2) -- skip name argument
reason = reason:gsub(":+", "") -- strip semicolons as it is used to delimit ban lists
message1 = message1 .. ": " .. reason
message2 = message2 .. " (" .. reason .. ")"
message = message .. ": " .. reason
end

Server.KickClient(player, message1)
Server.BroadcastMessage(message2)
Server.KickClient(player, message)

EssentialsPlugin.Ban_banList[name] = { reason }
EssentialsPlugin.Ban_SaveBans()
Expand All @@ -47,7 +44,7 @@ EssentialsPlugin.Ban_UnbanCommand = function(client, args)
EssentialsPlugin.Ban_banList[name] = nil
EssentialsPlugin.Ban_SaveBans()

Server.SendMessage(client, "&eUnbanned player " .. name)
Server.BroadcastMessage("&e" .. client.name .. " unbanned player " .. name)
end

EssentialsPlugin.Ban_BanIpCommand = function(client, args)
Expand All @@ -68,17 +65,13 @@ EssentialsPlugin.Ban_BanIpCommand = function(client, args)
local clients = Server.GetClients()
for _,v in pairs(clients) do
if (v:GetIpString() == ip) then
local message1 = "IP Banned"
local message2 = "&e" .. client.name .. " IP banned " .. v.name
local message = "IP Banned"

if (reason ~= nil) then
message1 = message1 .. ": " .. reason
message2 = message2 .. " (" .. reason .. ")"
message = message .. ": " .. reason
end

Server.KickClient(v, message1)
EssentialsPlugin.Ban_banList[string.lower(v.name)] = { reason } -- ban name too
Server.SystemWideMessage(message2)
Server.KickClient(v, message)

break;
end
Expand Down
7 changes: 2 additions & 5 deletions plugins/essentials/misc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,14 @@ EssentialsPlugin.Kick_KickCommand = function(client, args)

targetName = target.name;

local message = client.name .. " kicked " .. targetName
local reason = ""
local reason = "Kicked by " .. client.name

local index = 2 -- where reason should start
if (args[index] ~= nil) then
reason = table.concat(args, " ", index)
message = message .. " (" .. reason .. ")"
reason = reason .. ": " .. table.concat(args, " ", index)
end

Server.KickClient(target, reason)
Server.SystemWideMessage(message)
end

EssentialsPlugin.Misc_OnWorldJoin = function(client, args)
Expand Down

0 comments on commit 8a4efcc

Please sign in to comment.