From 4237e2cf4a4f6f50f839e38ed06d21553d1656b3 Mon Sep 17 00:00:00 2001 From: John Zha Date: Tue, 31 May 2022 19:00:10 +0800 Subject: [PATCH] Ignore by usergroup --- SpectatorList/Config.cs | 4 +++ SpectatorList/EventHandlers.cs | 6 ++-- SpectatorList/SpectatorList.csproj | 49 ++++++++++++++++++++++-------- SpectatorList/packages.config | 4 +++ 4 files changed, 49 insertions(+), 14 deletions(-) create mode 100644 SpectatorList/packages.config diff --git a/SpectatorList/Config.cs b/SpectatorList/Config.cs index 79ddaf3..8455fd7 100644 --- a/SpectatorList/Config.cs +++ b/SpectatorList/Config.cs @@ -1,5 +1,6 @@ using Exiled.API.Interfaces; using System.ComponentModel; +using System.Collections.Generic; namespace SpectatorList { @@ -13,5 +14,8 @@ public sealed class Config : IConfig [Description("Whether or not Northwood Staff should be Ignored. (Global Moderators will ALWAYS be Ignored)")] public bool IgnoreNorthwood { get; set; } = false; + + [Description("RA Roles that get ignored.")] + public List IgnoredRoles { get; set; } = new List(); } } \ No newline at end of file diff --git a/SpectatorList/EventHandlers.cs b/SpectatorList/EventHandlers.cs index 27fd56a..91a16e6 100644 --- a/SpectatorList/EventHandlers.cs +++ b/SpectatorList/EventHandlers.cs @@ -5,6 +5,7 @@ using NorthwoodLib.Pools; using System.Collections.Generic; using System.Text; +using UnityEngine; namespace SpectatorList { @@ -31,6 +32,7 @@ private IEnumerator SpectatorList(Player player) foreach (Player splayer in player.CurrentSpectatingPlayers) { if (splayer == player || splayer.IsGlobalModerator || + plugin.Config.IgnoredRoles.Contains(player.GroupName) || splayer.IsOverwatchEnabled && plugin.Config.IgnoreOverwatch || splayer.IsNorthwoodStaff && plugin.Config.IgnoreNorthwood) continue; @@ -43,8 +45,8 @@ private IEnumerator SpectatorList(Player player) if (count > 0) player.ShowHint( StringBuilderPool.Shared.ToStringReturn(list).Replace("(COUNT)", $"{count}") - .Replace("(COLOR)", player.Role.Color.ToHex()), 1.2f); - else StringBuilderPool.Shared.Return(list); + .Replace("(COLOR)", "#" + ColorUtility.ToHtmlStringRGB(player.Role.Color)), 1.2f); + else StringBuilderPool.Shared.Return(list); } } } diff --git a/SpectatorList/SpectatorList.csproj b/SpectatorList/SpectatorList.csproj index 2731705..1c98a78 100644 --- a/SpectatorList/SpectatorList.csproj +++ b/SpectatorList/SpectatorList.csproj @@ -33,22 +33,44 @@ - D:\SFNetwork\references\Assembly-CSharp-firstpass.dll + $(EXILED_REFERENCES)\Assembly-CSharp-firstpass.dll - - D:\SFNetwork\references\Assembly-CSharp-Publicized.dll + + ..\packages\EXILED.5.2.1\lib\net472\Assembly-CSharp-Publicized.dll + True - - D:\SFNetwork\references\Exiled.API.dll + + ..\packages\EXILED.5.2.1\lib\net472\CommandSystem.Core.dll - - D:\SFNetwork\references\Exiled.Events.dll + + ..\packages\EXILED.5.2.1\lib\net472\Exiled.API.dll - - D:\SFNetwork\references\Exiled.Loader.dll + + ..\packages\EXILED.5.2.1\lib\net472\Exiled.Bootstrap.dll - - D:\SFNetwork\references\NorthwoodLib.dll + + ..\packages\EXILED.5.2.1\lib\net472\Exiled.CreditTags.dll + + + ..\packages\EXILED.5.2.1\lib\net472\Exiled.CustomItems.dll + + + ..\packages\EXILED.5.2.1\lib\net472\Exiled.CustomRoles.dll + + + ..\packages\EXILED.5.2.1\lib\net472\Exiled.Events.dll + + + ..\packages\EXILED.5.2.1\lib\net472\Exiled.Loader.dll + + + ..\packages\EXILED.5.2.1\lib\net472\Exiled.Permissions.dll + + + ..\packages\EXILED.5.2.1\lib\net472\Exiled.Updater.dll + + + ..\packages\EXILED.5.2.1\lib\net472\NorthwoodLib.dll @@ -59,7 +81,7 @@ - D:\SFNetwork\references\UnityEngine.CoreModule.dll + $(EXILED_REFERENCES)\UnityEngine.CoreModule.dll @@ -69,6 +91,9 @@ + + + diff --git a/SpectatorList/packages.config b/SpectatorList/packages.config new file mode 100644 index 0000000..cfe28c8 --- /dev/null +++ b/SpectatorList/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file