var escapedText = FormattedMessage.EscapeText(message.Text);
string bwoinkText;
+ string adminPrefix = "";
+
+ //Getting an administrator position
+ if (_config.GetCVar(CCVars.AhelpAdminPrefix) && senderAdmin is not null && senderAdmin.Title is not null)
+ {
+ adminPrefix = $"[bold]\\[{senderAdmin.Title}\\][/bold] ";
+ }
if (senderAdmin is not null &&
senderAdmin.Flags ==
AdminFlags.Adminhelp) // Mentor. Not full admin. That's why it's colored differently.
{
- bwoinkText = $"[color=purple]{senderSession.Name}[/color]";
+ bwoinkText = $"[color=purple]{adminPrefix}{senderSession.Name}[/color]";
}
else if (senderAdmin is not null && senderAdmin.HasFlag(AdminFlags.Adminhelp))
{
- bwoinkText = $"[color=red]{senderSession.Name}[/color]";
+ bwoinkText = $"[color=red]{adminPrefix}{senderSession.Name}[/color]";
}
else
{
RaiseNetworkEvent(msg, channel);
}
+ string adminPrefixWebhook = "";
+
+ if (_config.GetCVar(CCVars.AhelpAdminPrefixWebhook) && senderAdmin is not null && senderAdmin.Title is not null)
+ {
+ adminPrefixWebhook = $"[bold]\\[{senderAdmin.Title}\\][/bold] ";
+ }
+
// Notify player
if (_playerManager.TryGetSessionById(message.UserId, out var session))
{
senderAdmin.Flags ==
AdminFlags.Adminhelp) // Mentor. Not full admin. That's why it's colored differently.
{
- overrideMsgText = $"[color=purple]{_overrideClientName}[/color]";
+ overrideMsgText = $"[color=purple]{adminPrefixWebhook}{_overrideClientName}[/color]";
}
else if (senderAdmin is not null && senderAdmin.HasFlag(AdminFlags.Adminhelp))
{
- overrideMsgText = $"[color=red]{_overrideClientName}[/color]";
+ overrideMsgText = $"[color=red]{adminPrefixWebhook}{_overrideClientName}[/color]";
}
else
{
public static readonly CVarDef<bool> AdminBypassMaxPlayers =
CVarDef.Create("admin.bypass_max_players", true, CVar.SERVERONLY);
+ /// <summary>
+ /// Determine if custom rank names are used.
+ /// If it is false, it'd use the actual rank name regardless of the individual's title.
+ /// </summary>
+ /// <seealso cref="AhelpAdminPrefix"/>
+ /// <seealso cref="AhelpAdminPrefixWebhook"/>
+ public static readonly CVarDef<bool> AdminUseCustomNamesAdminRank =
+ CVarDef.Create("admin.use_custom_names_admin_rank", true, CVar.SERVERONLY);
+
/*
* AHELP
*/
public static readonly CVarDef<int> AhelpRateLimitCount =
CVarDef.Create("ahelp.rate_limit_count", 10, CVar.SERVERONLY);
+ /// <summary>
+ /// Should the administrator's position be displayed in ahelp.
+ /// If it is is false, only the admin's ckey will be displayed in the ahelp.
+ /// </summary>
+ /// <seealso cref="AdminUseCustomNamesAdminRank"/>
+ /// <seealso cref="AhelpAdminPrefixWebhook"/>
+ public static readonly CVarDef<bool> AhelpAdminPrefix =
+ CVarDef.Create("ahelp.admin_prefix", true, CVar.SERVERONLY);
+
+ /// <summary>
+ /// Should the administrator's position be displayed in the webhook.
+ /// If it is is false, only the admin's ckey will be displayed in webhook.
+ /// </summary>
+ /// <seealso cref="AdminUseCustomNamesAdminRank"/>
+ /// <seealso cref="AhelpAdminPrefix"/>
+ public static readonly CVarDef<bool> AhelpAdminPrefixWebhook =
+ CVarDef.Create("ahelp.admin_prefix_webhook", true, CVar.SERVERONLY);
+
/*
* Explosions
*/