diff --git a/Pal.Client/Pal.Client.csproj b/Pal.Client/Pal.Client.csproj index ab9ba20..f95eaa9 100644 --- a/Pal.Client/Pal.Client.csproj +++ b/Pal.Client/Pal.Client.csproj @@ -3,7 +3,7 @@ net7.0-windows 11.0 - 2.7 + 2.8 enable diff --git a/Pal.Client/Rendering/SplatoonRenderer.cs b/Pal.Client/Rendering/SplatoonRenderer.cs index 4865eb5..c4969e3 100644 --- a/Pal.Client/Rendering/SplatoonRenderer.cs +++ b/Pal.Client/Rendering/SplatoonRenderer.cs @@ -19,6 +19,7 @@ namespace Pal.Client.Rendering internal class SplatoonRenderer : IRenderer, IDrawDebugItems, IDisposable { private const long ON_TERRITORY_CHANGE = -2; + private bool IsDisposed { get; set; } = false; public SplatoonRenderer(DalamudPluginInterface pluginInterface, IDalamudPlugin plugin) { @@ -74,7 +75,7 @@ namespace Pal.Client.Rendering color = color, thicc = 2, }; - return new SplatoonElement(element); + return new SplatoonElement(this, element); } public void DrawDebugItems(Vector4 trapColor, Vector4 hoardColor) @@ -123,6 +124,8 @@ namespace Pal.Client.Rendering public void Dispose() { + IsDisposed = true; + ResetLayer(ELayer.TrapHoard); ResetLayer(ELayer.RegularCoffers); @@ -131,14 +134,17 @@ namespace Pal.Client.Rendering public class SplatoonElement : IRenderElement { - public SplatoonElement(Element element) + private readonly SplatoonRenderer renderer; + + public SplatoonElement(SplatoonRenderer renderer, Element element) { + this.renderer = renderer; Delegate = element; } public Element Delegate { get; } - public bool IsValid => Delegate.IsValid(); + public bool IsValid => !renderer.IsDisposed && Delegate.IsValid(); public uint Color { get => Delegate.color;