diff --git a/SpectatorList/Config.cs b/SpectatorList/Config.cs index b21486c..0e1b79f 100644 --- a/SpectatorList/Config.cs +++ b/SpectatorList/Config.cs @@ -1,4 +1,7 @@ -using Exiled.API.Interfaces; +using System.Collections.Generic; +using System.ComponentModel; +using Exiled.API.Interfaces; +using PlayerRoles; namespace SpectatorList { @@ -6,6 +9,11 @@ public class Config : IConfig { public bool IsEnabled { get; set; } = true; public bool Debug { get; set; } = false; + [Description("A list of teams the hints should be hidden for")] + public List HiddenFor { get; set; } = new List(); + [Description("How often in seconds to refresh the hud")] public float RefreshRate { get; set; } = 2; + public string FullText { get; set; } = "%display%"; + public string PlayerDisplay { get; set; } = "%name%"; } } \ No newline at end of file diff --git a/SpectatorList/EventHandler.cs b/SpectatorList/EventHandler.cs index ddd7cf2..3b0e153 100644 --- a/SpectatorList/EventHandler.cs +++ b/SpectatorList/EventHandler.cs @@ -9,11 +9,13 @@ namespace SpectatorList { public class EventHandler { + private Config _config => SpectatorList.Instance.Config; + public EventHandler() => Timing.RunCoroutine(DoList()); private IEnumerator DoList() { - while (true) + for (; ;) { if (Round.IsEnded) { @@ -23,7 +25,7 @@ private IEnumerator DoList() foreach (Player player in Player.List) { - if (player.IsDead) continue; + if (player.IsDead || _config.HiddenFor.Contains(player.Role.Team)) continue; int count = player.CurrentSpectatingPlayers.Count(p => p.Role != RoleTypeId.Overwatch); @@ -32,13 +34,13 @@ private IEnumerator DoList() foreach (Player spectator in player.CurrentSpectatingPlayers.Where(p => p.Role != RoleTypeId.Overwatch)) { - sb.AppendLine(spectator.DisplayNickname); + sb.AppendLine(_config.PlayerDisplay.Replace("%name%", spectator.DisplayNickname)); } - player.ShowHint($"{sb}", SpectatorList.Instance.Config.RefreshRate + 0.15f); + player.ShowHint(_config.FullText.Replace("%display%", sb.ToString()), _config.RefreshRate + 0.15f); } - yield return Timing.WaitForSeconds(SpectatorList.Instance.Config.RefreshRate); + yield return Timing.WaitForSeconds(_config.RefreshRate); } } } diff --git a/SpectatorList/SpectatorList.cs b/SpectatorList/SpectatorList.cs index 0eeff20..e8941fe 100644 --- a/SpectatorList/SpectatorList.cs +++ b/SpectatorList/SpectatorList.cs @@ -9,7 +9,7 @@ public class SpectatorList : Plugin public override string Name { get; } = "Spectator List"; public override string Author { get; } = "@misfiy"; - public override Version Version { get; } = new Version(1,0,0); + public override Version Version { get; } = new Version(1,1,0); public override Version RequiredExiledVersion { get; } = new Version(8, 8, 1); private EventHandler _handler;