You've already forked ComfyFactorio
mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-11-06 08:56:27 +02:00
Fix server name when a player is banned
This commit is contained in:
@@ -10,8 +10,7 @@ local ban_by_join_enabled = false
|
|||||||
local try_get_ban = Server.try_get_ban
|
local try_get_ban = Server.try_get_ban
|
||||||
|
|
||||||
local valid_commands = {
|
local valid_commands = {
|
||||||
['ban'] = true,
|
['ban'] = true
|
||||||
['unban'] = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local try_get_is_banned_token =
|
local try_get_is_banned_token =
|
||||||
|
|||||||
@@ -608,7 +608,7 @@ local function jail(player, offender, msg, raised, mute)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local to_jail_player = game.get_player(offender)
|
local to_jail_player = game.get_player(offender)
|
||||||
if not to_jail_player then
|
if not to_jail_player or not to_jail_player.valid then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1432,9 +1432,6 @@ function Public.ban_handler(event)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local reason
|
|
||||||
local str = ''
|
|
||||||
|
|
||||||
local t = {}
|
local t = {}
|
||||||
for i in gmatch(user, '%S+') do
|
for i in gmatch(user, '%S+') do
|
||||||
insert(t, i)
|
insert(t, i)
|
||||||
@@ -1442,62 +1439,12 @@ function Public.ban_handler(event)
|
|||||||
|
|
||||||
local target = t[1]
|
local target = t[1]
|
||||||
|
|
||||||
for i = 2, #t do
|
|
||||||
str = str .. t[i] .. ' '
|
|
||||||
reason = str
|
|
||||||
end
|
|
||||||
|
|
||||||
if not target then
|
if not target then
|
||||||
return print('[on_console_command] - target was undefined.')
|
return print('[on_console_command] - target was undefined.')
|
||||||
end
|
end
|
||||||
|
|
||||||
if event.player_index then
|
if cmd == 'ban' then
|
||||||
local player = game.get_player(event.player_index)
|
Public.set_data(jailed_data_set, target, nil) -- this is added here since we don't want to clutter the jail dataset.
|
||||||
if player and player.valid and player.admin then
|
|
||||||
local data = Public.build_embed_data()
|
|
||||||
data.username = target
|
|
||||||
data.admin = player.name
|
|
||||||
|
|
||||||
if cmd == 'ban' then
|
|
||||||
Public.set_data(jailed_data_set, target, nil) -- this is added here since we don't want to clutter the jail dataset.
|
|
||||||
if not reason then
|
|
||||||
data.reason = 'Not specified.'
|
|
||||||
Public.to_banned_embed(data)
|
|
||||||
return
|
|
||||||
else
|
|
||||||
data.reason = reason
|
|
||||||
Public.to_banned_embed(data)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
elseif cmd == 'unban' then
|
|
||||||
Public.to_unbanned_embed(data)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
local data = Public.build_embed_data()
|
|
||||||
data.username = target
|
|
||||||
data.admin = '<server>'
|
|
||||||
|
|
||||||
if event.user_override then
|
|
||||||
data.admin = event.user_override
|
|
||||||
end
|
|
||||||
|
|
||||||
if cmd == 'ban' then
|
|
||||||
Public.set_data(jailed_data_set, target, nil) -- this is added here since we don't want to clutter the jail dataset.
|
|
||||||
if not reason then
|
|
||||||
data.reason = 'Not specified.'
|
|
||||||
Public.to_banned_embed(data)
|
|
||||||
return
|
|
||||||
else
|
|
||||||
data.reason = reason
|
|
||||||
Public.to_banned_embed(data)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
elseif cmd == 'unban' then
|
|
||||||
Public.to_unbanned_embed(data)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user