mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-09-22 01:04:01 +00:00
Merge branch 'explosivegaming:main' into aperx2
This commit is contained in:
@@ -5,7 +5,6 @@ return {
|
||||
show_playtime = true,
|
||||
entity_protection = true,
|
||||
player_reports = true,
|
||||
player_warnings = true,
|
||||
player_bans = true,
|
||||
player_mutes = true,
|
||||
player_kicks = true,
|
||||
|
||||
@@ -9,8 +9,7 @@ local ExpUtil = require("modules/exp_util")
|
||||
local Gui = require("modules/exp_gui")
|
||||
local Roles = require("modules/exp_roles")
|
||||
local Reports = require("modules.exp_legacy.modules.control.reports") --- @dep modules.control.reports
|
||||
local Warnings = require("modules.exp_legacy.modules.control.warnings") --- @dep modules.control.warnings
|
||||
local Jail = require("modules.exp_legacy.modules.control.jail") --- @dep modules.control.jail
|
||||
local Jail = require("modules/exp_scenario/control/jail")
|
||||
local Colors = require("modules/exp_util/include/color")
|
||||
local format_player_name = ExpUtil.format_player_name_locale
|
||||
|
||||
@@ -100,26 +99,12 @@ local function report_player_callback(player, reason)
|
||||
Reports.report_player(selected_player.name, player.name, reason)
|
||||
end
|
||||
|
||||
--- Gives the action player a warning, requires a reason
|
||||
-- @element warn_player
|
||||
local warn_player = new_button("utility/spawn_flag", { "exp-gui_player-list.warn-player" })
|
||||
:on_click(function(def, player, element)
|
||||
set_selected_action(player, "exp_scenario.command.create_warning")
|
||||
end)
|
||||
|
||||
local function warn_player_callback(player, reason)
|
||||
local selected_player, selected_player_color = get_action_player(player)
|
||||
local by_player_name_color = format_player_name(player)
|
||||
game.print{ "exp-commands_warnings.create", selected_player_color, by_player_name_color, reason }
|
||||
Warnings.add_warning(selected_player.name, player.name, reason)
|
||||
end
|
||||
|
||||
--- Jails the action player, requires a reason
|
||||
-- @element jail_player
|
||||
local jail_player = new_button("utility/multiplayer_waiting_icon", { "exp-gui_player-list.jail-player" })
|
||||
:on_click(function(def, player, element)
|
||||
local selected_player, selected_player_color = get_action_player(player)
|
||||
if Jail.is_jailed(selected_player.name) then
|
||||
if Jail.is_jailed(selected_player) then
|
||||
player.print({ "exp-commands_jail.already-jailed", selected_player_color }, Colors.orange_red)
|
||||
else
|
||||
set_selected_action(player, "exp_scenario.command.jail")
|
||||
@@ -130,7 +115,7 @@ local function jail_player_callback(player, reason)
|
||||
local selected_player, selected_player_color = get_action_player(player)
|
||||
local by_player_name_color = format_player_name(player)
|
||||
game.print{ "exp-commands_jail.jailed", selected_player_color, by_player_name_color, reason }
|
||||
Jail.jail_player(selected_player.name, player.name, reason)
|
||||
Jail.jail_player(selected_player, player.name, reason)
|
||||
end
|
||||
|
||||
--- Kicks the action player, requires a reason
|
||||
@@ -170,18 +155,11 @@ return {
|
||||
["exp_scenario.command.create_report"] = {
|
||||
auth = function(player, selected_player)
|
||||
if player == selected_player then return false end
|
||||
if not Roles.player_has_permission(player, "exp_scenario.command.create_warning") then
|
||||
return not Roles.player_has_permission(selected_player, "exp_scenario.bypass.reports")
|
||||
end
|
||||
end, -- can report any player that isn't immune and you aren't able to give warnings
|
||||
return not Roles.player_has_permission(selected_player, "exp_scenario.bypass.reports")
|
||||
end, -- can report any player that isn't immune
|
||||
reason_callback = report_player_callback,
|
||||
report_player,
|
||||
},
|
||||
["exp_scenario.command.create_warning"] = {
|
||||
auth = Roles.player_outranks, -- warn a lower user, replaces report
|
||||
reason_callback = warn_player_callback,
|
||||
warn_player,
|
||||
},
|
||||
["exp_scenario.command.jail"] = {
|
||||
auth = Roles.player_outranks,
|
||||
reason_callback = jail_player_callback,
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
--- Config file for the warning system, this is very similar to reports but is for the use of moderators rather than normal users.
|
||||
-- @config Warnings
|
||||
|
||||
return {
|
||||
--- @type (LocalisedString[] | fun(player: LuaPlayer, by_player_name: string, number_of_warnings: number))[]
|
||||
actions = { --- @setting actions what actions are taking at number of warnings
|
||||
-- if a localized string is used then __1__ will by_player_name and __2__ will be the current warning count (auto inserted)
|
||||
{ "warnings.received", "" },
|
||||
{ "warnings.received", "" },
|
||||
{ "warnings.received", { "warnings.pre-kick" } },
|
||||
function(player, by_player_name, number_of_warnings)
|
||||
local str = {
|
||||
"You received a warning from ",
|
||||
by_player_name,
|
||||
". You have ",
|
||||
number_of_warnings,
|
||||
" warnings. You were kicked for having too many warnings; you may rejoin if you wish.",
|
||||
}
|
||||
game.kick_player(player, table.concat(str, "")) -- Does not support locale strings
|
||||
-- game.kick_player(player, { "warnings.received", by_player_name, number_of_warnings, { "warnings.kick" } })
|
||||
end,
|
||||
{ "warnings.received", { "warnings.pre-pre-ban" } },
|
||||
{ "warnings.received", { "warnings.pre-ban" } },
|
||||
function(player, by_player_name, number_of_warnings)
|
||||
local str = {
|
||||
"You received a warning from ",
|
||||
by_player_name,
|
||||
". You have ",
|
||||
number_of_warnings,
|
||||
" warnings. You were banned for having too many warnings; visit https://www.explosivegaming.nl to request a ban appeal.",
|
||||
}
|
||||
game.kick_player(player, table.concat(str, "")) -- Does not support locale strings
|
||||
-- game.ban_player(player, { "warnings.received", by_player_name, number_of_warnings, { "warnings.ban", { "links.website" } } })
|
||||
end,
|
||||
},
|
||||
script_warning_cool_down = 30, --- @setting script_warning_cool_down time for a script warning (given by script) to be removed (in minutes)
|
||||
script_warning_limit = 5, --- @setting script_warning_limit the number of script warnings (given by script) that are allowed before full warnings are given
|
||||
}
|
||||
Reference in New Issue
Block a user