Skip to content

Commit

Permalink
Ignore by usergroup
Browse files Browse the repository at this point in the history
  • Loading branch information
Misaka-ZeroTwo committed May 31, 2022
1 parent 2524486 commit 4237e2c
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 14 deletions.
4 changes: 4 additions & 0 deletions SpectatorList/Config.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Exiled.API.Interfaces;
using System.ComponentModel;
using System.Collections.Generic;

namespace SpectatorList
{
Expand All @@ -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<string> IgnoredRoles { get; set; } = new List<string>();
}
}
6 changes: 4 additions & 2 deletions SpectatorList/EventHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using NorthwoodLib.Pools;
using System.Collections.Generic;
using System.Text;
using UnityEngine;

namespace SpectatorList
{
Expand All @@ -31,6 +32,7 @@ private IEnumerator<float> 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;

Expand All @@ -43,8 +45,8 @@ private IEnumerator<float> 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);
}
}
}
Expand Down
49 changes: 37 additions & 12 deletions SpectatorList/SpectatorList.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,44 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>D:\SFNetwork\references\Assembly-CSharp-firstpass.dll</HintPath>
<HintPath>$(EXILED_REFERENCES)\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-Publicized">
<HintPath>D:\SFNetwork\references\Assembly-CSharp-Publicized.dll</HintPath>
<Reference Include="Assembly-CSharp-Publicized, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\Assembly-CSharp-Publicized.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Exiled.API">
<HintPath>D:\SFNetwork\references\Exiled.API.dll</HintPath>
<Reference Include="CommandSystem.Core, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\CommandSystem.Core.dll</HintPath>
</Reference>
<Reference Include="Exiled.Events">
<HintPath>D:\SFNetwork\references\Exiled.Events.dll</HintPath>
<Reference Include="Exiled.API, Version=5.2.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\Exiled.API.dll</HintPath>
</Reference>
<Reference Include="Exiled.Loader">
<HintPath>D:\SFNetwork\references\Exiled.Loader.dll</HintPath>
<Reference Include="Exiled.Bootstrap, Version=5.2.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\Exiled.Bootstrap.dll</HintPath>
</Reference>
<Reference Include="NorthwoodLib">
<HintPath>D:\SFNetwork\references\NorthwoodLib.dll</HintPath>
<Reference Include="Exiled.CreditTags, Version=5.2.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\Exiled.CreditTags.dll</HintPath>
</Reference>
<Reference Include="Exiled.CustomItems, Version=5.2.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\Exiled.CustomItems.dll</HintPath>
</Reference>
<Reference Include="Exiled.CustomRoles, Version=5.2.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\Exiled.CustomRoles.dll</HintPath>
</Reference>
<Reference Include="Exiled.Events, Version=5.2.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\Exiled.Events.dll</HintPath>
</Reference>
<Reference Include="Exiled.Loader, Version=5.2.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\Exiled.Loader.dll</HintPath>
</Reference>
<Reference Include="Exiled.Permissions, Version=5.2.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\Exiled.Permissions.dll</HintPath>
</Reference>
<Reference Include="Exiled.Updater, Version=3.1.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\Exiled.Updater.dll</HintPath>
</Reference>
<Reference Include="NorthwoodLib, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\NorthwoodLib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -59,7 +81,7 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine.CoreModule">
<HintPath>D:\SFNetwork\references\UnityEngine.CoreModule.dll</HintPath>
<HintPath>$(EXILED_REFERENCES)\UnityEngine.CoreModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand All @@ -69,6 +91,9 @@
<Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
Expand Down
4 changes: 4 additions & 0 deletions SpectatorList/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EXILED" version="5.2.1" targetFramework="net472" />
</packages>

0 comments on commit 4237e2c

Please sign in to comment.