mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-31 13:01:39 +09:00
Added playtime to some alerts
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
-- @config Discord-Alerts
|
-- @config Discord-Alerts
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
show_playtime=true,
|
||||||
entity_protection=true,
|
entity_protection=true,
|
||||||
player_reports=true,
|
player_reports=true,
|
||||||
player_warnings=true,
|
player_warnings=true,
|
||||||
|
|||||||
@@ -6,6 +6,13 @@ local Colors = require 'utils.color_presets' --- @dep utils.color_presets
|
|||||||
local write_json, format_time = _C.write_json, _C.format_time --- @dep expcore.common
|
local write_json, format_time = _C.write_json, _C.format_time --- @dep expcore.common
|
||||||
local config = require 'config.discord_alerts' --- @dep config.discord_alerts
|
local config = require 'config.discord_alerts' --- @dep config.discord_alerts
|
||||||
|
|
||||||
|
local function append_playtime(player_name)
|
||||||
|
if not config.show_playtime then return player_name end
|
||||||
|
local player = game.get_player(player_name)
|
||||||
|
if not player then return player_name end
|
||||||
|
return player.name..' ('..format_time(player.online_time)..')'
|
||||||
|
end
|
||||||
|
|
||||||
local function get_player_name(event)
|
local function get_player_name(event)
|
||||||
local player = game.players[event.player_index]
|
local player = game.players[event.player_index]
|
||||||
return player.name, event.by_player_name
|
return player.name, event.by_player_name
|
||||||
@@ -85,7 +92,7 @@ if config.entity_protection then
|
|||||||
title='Entity Protection',
|
title='Entity Protection',
|
||||||
description='A player removed protected entities',
|
description='A player removed protected entities',
|
||||||
color=Colors.yellow,
|
color=Colors.yellow,
|
||||||
['Player']='<inline>'..player_name,
|
['Player']='<inline>'..append_playtime(player_name),
|
||||||
['Entity']='<inline>'..event.entity.name
|
['Entity']='<inline>'..event.entity.name
|
||||||
}
|
}
|
||||||
end)
|
end)
|
||||||
@@ -100,8 +107,8 @@ if config.player_reports then
|
|||||||
title='Report',
|
title='Report',
|
||||||
description='A player was reported',
|
description='A player was reported',
|
||||||
color=Colors.yellow,
|
color=Colors.yellow,
|
||||||
['Player']='<inline>'..player_name,
|
['Player']='<inline>'..append_playtime(player_name),
|
||||||
['By']='<inline>'..by_player_name,
|
['By']='<inline>'..append_playtime(by_player_name),
|
||||||
['Report Count']='<inline>'..Reports.count_reports(player_name),
|
['Report Count']='<inline>'..Reports.count_reports(player_name),
|
||||||
['Reason']=event.reason
|
['Reason']=event.reason
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user