From c51c4979dd051902f3f997655e36c187d919b05b Mon Sep 17 00:00:00 2001 From: MSWS Date: Sat, 27 Jan 2024 01:19:03 -0800 Subject: [PATCH] Allow warden pings through, remove/factor draw manager --- Jailbreak.sln | 7 ---- mod/Jailbreak.Draw/DrawServiceExtension.cs | 14 -------- mod/Jailbreak.Draw/Global/DrawManager.cs | 32 ------------------- .../Markers/WardenMarkerBehavior.cs | 7 ++-- .../Jailbreak.Public/Mod/Draw/IDrawService.cs | 7 ---- src/Jailbreak/Jailbreak.csproj | 1 - src/Jailbreak/JailbreakServiceCollection.cs | 1 - 7 files changed, 2 insertions(+), 67 deletions(-) delete mode 100644 mod/Jailbreak.Draw/DrawServiceExtension.cs delete mode 100644 mod/Jailbreak.Draw/Global/DrawManager.cs delete mode 100644 public/Jailbreak.Public/Mod/Draw/IDrawService.cs diff --git a/Jailbreak.sln b/Jailbreak.sln index 108dcc12..9570efb8 100644 --- a/Jailbreak.sln +++ b/Jailbreak.sln @@ -22,8 +22,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "lang", "lang", "{CDCDE44E-0 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jailbreak.English", "lang\Jailbreak.English\Jailbreak.English.csproj", "{FC2D6F50-BCFF-41E6-A965-6C73CC01C3BF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jailbreak.Draw", "mod\Jailbreak.Draw\Jailbreak.Draw.csproj", "{E809B726-088D-4BC6-95C9-EE6A991C8AA9}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -58,10 +56,6 @@ Global {FC2D6F50-BCFF-41E6-A965-6C73CC01C3BF}.Debug|Any CPU.Build.0 = Debug|Any CPU {FC2D6F50-BCFF-41E6-A965-6C73CC01C3BF}.Release|Any CPU.ActiveCfg = Release|Any CPU {FC2D6F50-BCFF-41E6-A965-6C73CC01C3BF}.Release|Any CPU.Build.0 = Release|Any CPU - {E809B726-088D-4BC6-95C9-EE6A991C8AA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E809B726-088D-4BC6-95C9-EE6A991C8AA9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E809B726-088D-4BC6-95C9-EE6A991C8AA9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E809B726-088D-4BC6-95C9-EE6A991C8AA9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {9135CCC9-66C5-4A9C-AE3C-91475B5F0437} = {177DA48D-8306-4102-918D-992569878581} @@ -71,6 +65,5 @@ Global {28EE05E4-8FE3-4CC6-AA03-0C533EFBFBF2} = {36BA84C0-291C-4930-A7C6-97CDF8F7F0D7} {446E0B6F-E4FE-45E6-BD9B-BD943698327A} = {59311734-3648-43C2-B43C-385718B0D103} {FC2D6F50-BCFF-41E6-A965-6C73CC01C3BF} = {CDCDE44E-01D2-4B76-99DA-A57E1E956038} - {E809B726-088D-4BC6-95C9-EE6A991C8AA9} = {36BA84C0-291C-4930-A7C6-97CDF8F7F0D7} EndGlobalSection EndGlobal diff --git a/mod/Jailbreak.Draw/DrawServiceExtension.cs b/mod/Jailbreak.Draw/DrawServiceExtension.cs deleted file mode 100644 index 97de42a6..00000000 --- a/mod/Jailbreak.Draw/DrawServiceExtension.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Jailbreak.Draw.Global; -using Jailbreak.Public.Extensions; -using Jailbreak.Public.Mod.Draw; -using Microsoft.Extensions.DependencyInjection; - -namespace Jailbreak.Draw; - -public static class DrawServiceExtension -{ - public static void AddJailbreakDraw(this IServiceCollection serviceCollection) - { - serviceCollection.AddPluginBehavior(); - } -} \ No newline at end of file diff --git a/mod/Jailbreak.Draw/Global/DrawManager.cs b/mod/Jailbreak.Draw/Global/DrawManager.cs deleted file mode 100644 index f08526e7..00000000 --- a/mod/Jailbreak.Draw/Global/DrawManager.cs +++ /dev/null @@ -1,32 +0,0 @@ -using CounterStrikeSharp.API.Core; -using CounterStrikeSharp.API.Modules.Timers; -using Jailbreak.Public.Behaviors; -using Jailbreak.Public.Mod.Draw; - -namespace Jailbreak.Draw.Global; - -public class DrawManager : IPluginBehavior, IDrawService -{ - private List shapes = new List(); - - public void Start(BasePlugin plugin) - { - plugin.AddTimer(1f, Tick, TimerFlags.REPEAT); - } - - private void Tick() - { - shapes.ForEach(s => s.Tick()); - } - - public void DrawShape(DrawableShape shape, float tickRate = 0f) - { - shape.Draw(); - shapes.Add(shape); - } - - public List GetShapes() - { - return shapes; - } -} \ No newline at end of file diff --git a/mod/Jailbreak.Warden/Markers/WardenMarkerBehavior.cs b/mod/Jailbreak.Warden/Markers/WardenMarkerBehavior.cs index 334b75b0..c33ca7dd 100644 --- a/mod/Jailbreak.Warden/Markers/WardenMarkerBehavior.cs +++ b/mod/Jailbreak.Warden/Markers/WardenMarkerBehavior.cs @@ -11,14 +11,12 @@ namespace Jailbreak.Warden.Markers; public class WardenMarkerBehavior : IPluginBehavior { private readonly IWardenService _warden; - private IDrawService _drawer; private DrawableShape? _marker; - public WardenMarkerBehavior(IWardenService warden, IDrawService drawer) + public WardenMarkerBehavior(IWardenService warden) { _warden = warden; - _drawer = drawer; } public void Start(BasePlugin plugin) @@ -44,7 +42,6 @@ public HookResult OnPing(EventPlayerPing @event, GameEventInfo info) HookResult CommandListener_PlayerPing(CCSPlayerController? player, CommandInfo info) { - player.PrintToChat("CommandListener worked"); - return HookResult.Handled; + return _warden.IsWarden(player) ? HookResult.Continue : HookResult.Handled; } } \ No newline at end of file diff --git a/public/Jailbreak.Public/Mod/Draw/IDrawService.cs b/public/Jailbreak.Public/Mod/Draw/IDrawService.cs deleted file mode 100644 index e8572a25..00000000 --- a/public/Jailbreak.Public/Mod/Draw/IDrawService.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Jailbreak.Public.Mod.Draw; - -public interface IDrawService { - void DrawShape(DrawableShape shape, float tickRate = 0f); - - List GetShapes(); -} \ No newline at end of file diff --git a/src/Jailbreak/Jailbreak.csproj b/src/Jailbreak/Jailbreak.csproj index 1fdd4b8f..0a0c71f4 100644 --- a/src/Jailbreak/Jailbreak.csproj +++ b/src/Jailbreak/Jailbreak.csproj @@ -33,7 +33,6 @@ - diff --git a/src/Jailbreak/JailbreakServiceCollection.cs b/src/Jailbreak/JailbreakServiceCollection.cs index 9f84071f..094112ab 100644 --- a/src/Jailbreak/JailbreakServiceCollection.cs +++ b/src/Jailbreak/JailbreakServiceCollection.cs @@ -33,7 +33,6 @@ public void ConfigureServices(IServiceCollection serviceCollection) serviceCollection.AddJailbreakGeneric(); serviceCollection.AddJailbreakWarden(); serviceCollection.AddJailbreakTeams(); - serviceCollection.AddJailbreakDraw(); // Add in english localization serviceCollection.AddLanguage(config =>