From 43e7ff4bec4cf54e6323d7859d90c0c3d454ca74 Mon Sep 17 00:00:00 2001 From: Terminator_97 <50580453+francesco132@users.noreply.github.com> Date: Thu, 3 Sep 2020 16:46:29 +0200 Subject: [PATCH] 2.3.4 --- SCPUtils/Commands/Help.cs | 2 +- SCPUtils/Configs.cs | 4 ++++ SCPUtils/Functions/EventHandlers.cs | 7 +++++-- SCPUtils/Functions/Functions.cs | 10 +++++++++- SCPUtils/Patches/SCPSpeak.cs | 1 + SCPUtils/Plugin.cs | 2 +- SCPUtils/Properties/AssemblyInfo.cs | 6 +++--- 7 files changed, 24 insertions(+), 8 deletions(-) diff --git a/SCPUtils/Commands/Help.cs b/SCPUtils/Commands/Help.cs index fa72b30..56dd192 100644 --- a/SCPUtils/Commands/Help.cs +++ b/SCPUtils/Commands/Help.cs @@ -19,7 +19,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s string text = ""; text = $"User commands: \n" + ".scputils_info, .scputils_change_nickname, .scputils_change_color, .scputils_show_badge, .scputils_hide_badge, .scputils_my_info"; - if (CommandExtensions.IsAllowed(((CommandSender)sender).SenderId, "scputils.help") && ((CommandSender)sender).FullPermissions) text += "\nAdministration commands (Remote Admin): \n" + + if (CommandExtensions.IsAllowed(((CommandSender)sender).SenderId, "scputils.help") || ((CommandSender)sender).FullPermissions) text += "\nAdministration commands (Remote Admin): \n" + "scputils_player_info, scputils_player_list, scputils_player_reset_preferences, scputils_player_reset, scputils_set_color, scputils_set_name, scputils_set_badge, scputils_revoke_badge, scputils_play_time, scputils_whitelist_asn, scputils_unwhitelist_asn, scputils_enable_suicide_warns, scputils_disable_suicide_warns, scputils_global_edit, scputils_player_edit, scputils_player_delete"; response = text; return true; diff --git a/SCPUtils/Configs.cs b/SCPUtils/Configs.cs index e69975a..5afff52 100644 --- a/SCPUtils/Configs.cs +++ b/SCPUtils/Configs.cs @@ -173,6 +173,10 @@ public class Configs : IConfig public Dictionary> CuffedSafeZones { get; private set; } = new Dictionary>(); + [Description("With which SCPs users are allowed to speak using V to humans without any badge (remove the disallowed SCPs)? (This will bypass permissions check so everyone will be able to speak with those SCPs regardless rank)")] + + public List AllowedScps { get; private set; } = new List() { RoleType.Scp049, RoleType.Scp0492, RoleType.Scp079, RoleType.Scp096, RoleType.Scp106, RoleType.Scp173, RoleType.Scp93953, RoleType.Scp93989 }; + public void ConfigValidator() { diff --git a/SCPUtils/Functions/EventHandlers.cs b/SCPUtils/Functions/EventHandlers.cs index 2404f1f..16c04e7 100644 --- a/SCPUtils/Functions/EventHandlers.cs +++ b/SCPUtils/Functions/EventHandlers.cs @@ -32,7 +32,10 @@ internal void OnPlayerDeath(DyingEventArgs ev) internal void OnRoundEnded(RoundEndedEventArgs ev) => TemporarilyDisabledWarns = true; - internal void OnWaitingForPlayers() => TemporarilyDisabledWarns = false; + internal void OnWaitingForPlayers() + { + TemporarilyDisabledWarns = false; + } internal void On079TeslaEvent(InteractingTeslaEventArgs ev) => lastTeslaEvent = DateTime.Now; @@ -62,7 +65,7 @@ internal void OnPlayerJoin(JoinedEventArgs ev) if (databasePlayer.FirstJoin == DateTime.MinValue) databasePlayer.FirstJoin = DateTime.Now; if (pluginInstance.Config.WelcomeEnabled) ev.Player.Broadcast(pluginInstance.Config.WelcomeMessageDuration, pluginInstance.Config.WelcomeMessage, Broadcast.BroadcastFlags.Normal); if (!string.IsNullOrEmpty(databasePlayer.CustomNickName) && databasePlayer.CustomNickName != "None") ev.Player.DisplayNickname = databasePlayer.CustomNickName; - if (pluginInstance.Config.ASNBlacklist.Contains(ev.Player.ReferenceHub.characterClassManager.Asn) && !databasePlayer.ASNWhitelisted) ev.Player.Kick($"Auto-Kick: {pluginInstance.Config.AsnKickMessage}", "SCPUtils"); + if (pluginInstance.Functions.CheckAsnPlayer(ev.Player)) ev.Player.Kick($"Auto-Kick: {pluginInstance.Config.AsnKickMessage}", "SCPUtils"); else pluginInstance.Functions.PostLoadPlayer(ev.Player); } diff --git a/SCPUtils/Functions/Functions.cs b/SCPUtils/Functions/Functions.cs index 0083915..7c566bb 100644 --- a/SCPUtils/Functions/Functions.cs +++ b/SCPUtils/Functions/Functions.cs @@ -23,7 +23,7 @@ public void AutoBanPlayer(Exiled.API.Features.Player player) player.GetDatabasePlayer().TotalScpSuicideBans++; if (pluginInstance.Config.MultiplyBanDurationEachBan == true) duration = player.GetDatabasePlayer().TotalScpSuicideBans * pluginInstance.Config.AutoBanDuration * 60; else duration = pluginInstance.Config.AutoBanDuration * 60; - if (pluginInstance.Config.BroadcastSanctions) BroadcastSuicideQuitAction($" {player.Nickname} ( {player.Role} ) has been BANNED from the server for exceeding Quits / Suicides (as SCP) limit. Duration: {duration} mitutes"); + if (pluginInstance.Config.BroadcastSanctions) BroadcastSuicideQuitAction($" {player.Nickname} ( {player.Role} ) has been BANNED from the server for exceeding Quits / Suicides (as SCP) limit. Duration: {duration / 60} mitutes"); player.Ban(duration, $"Auto-Ban: {string.Format(pluginInstance.Config.AutoBanMessage, duration)}", "SCPUtils"); } @@ -185,5 +185,13 @@ public bool CheckSafeZones(Exiled.API.Features.Player player) } + public bool CheckAsnPlayer(Exiled.API.Features.Player player) + { + var databasePlayer = player.GetDatabasePlayer(); + if (pluginInstance.Config.ASNBlacklist == null) return false; + if (pluginInstance.Config.ASNBlacklist.Contains(player.ReferenceHub.characterClassManager.Asn) && !databasePlayer.ASNWhitelisted) return true; + else return false; + } + } } \ No newline at end of file diff --git a/SCPUtils/Patches/SCPSpeak.cs b/SCPUtils/Patches/SCPSpeak.cs index f0215d4..a8ecaf4 100644 --- a/SCPUtils/Patches/SCPSpeak.cs +++ b/SCPUtils/Patches/SCPSpeak.cs @@ -13,6 +13,7 @@ public static void Prefix(DissonanceUserSetup __instance, bool value) { var player = Exiled.API.Features.Player.Get(__instance.gameObject); if (string.IsNullOrEmpty(player?.UserId) || player.Team != Team.SCP) return; + else if (ScpUtils.StaticInstance.Config.AllowedScps.Contains(player.Role)) { __instance.MimicAs939 = value; return; } else if (string.IsNullOrEmpty(ServerStatic.GetPermissionsHandler()._groups.FirstOrDefault(g => g.Value == player.ReferenceHub.serverRoles.Group).Key) && !string.IsNullOrEmpty(player.ReferenceHub.serverRoles.MyText)) return; else if (player.CheckPermission($"scputils_speak.{player.Role.ToString().ToLower()}")) { diff --git a/SCPUtils/Plugin.cs b/SCPUtils/Plugin.cs index 4c266ed..dd962d1 100644 --- a/SCPUtils/Plugin.cs +++ b/SCPUtils/Plugin.cs @@ -17,7 +17,7 @@ public class ScpUtils : Features.Plugin public static string pluginVersion = "2.3.3"; public override string Author { get; } = "Terminator_9#0507"; public override string Name { get; } = "SCPUtils"; - public override Version Version { get; } = new Version(2, 3, 3); + public override Version Version { get; } = new Version(2, 3, 4); public override Version RequiredExiledVersion { get; } = new Version(2, 1, 2); public EventHandlers EventHandlers { get; private set; } public Functions Functions { get; private set; } diff --git a/SCPUtils/Properties/AssemblyInfo.cs b/SCPUtils/Properties/AssemblyInfo.cs index fb4d5d2..6cb0d89 100644 --- a/SCPUtils/Properties/AssemblyInfo.cs +++ b/SCPUtils/Properties/AssemblyInfo.cs @@ -5,7 +5,7 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("SCPUtils")] -[assembly: AssemblyDescription("SCPUtils 2.3.3")] +[assembly: AssemblyDescription("SCPUtils 2.3.4")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SCPUtils")] @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.3.3.0")] -[assembly: AssemblyFileVersion("2.3.3.0")] \ No newline at end of file +[assembly: AssemblyVersion("2.3.4.0")] +[assembly: AssemblyFileVersion("2.3.4.0")] \ No newline at end of file