From 5e50078d59417fbde0134b1bc8f51e6384190c2c Mon Sep 17 00:00:00 2001 From: Anna Date: Sat, 24 Apr 2021 13:43:01 -0400 Subject: [PATCH] refactor: merge ifs and remove unnecessary check --- XivCommon/Functions/PartyFinder.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/XivCommon/Functions/PartyFinder.cs b/XivCommon/Functions/PartyFinder.cs index e11cb9e..ac6c49a 100755 --- a/XivCommon/Functions/PartyFinder.cs +++ b/XivCommon/Functions/PartyFinder.cs @@ -62,22 +62,17 @@ namespace XivCommon.Functions { } } - if (this.JoinsEnabled) { - if (scanner.TryScanText(Signatures.JoinCrossParty, out var joinPtr, "Party Finder joins")) { - this.JoinPfHook = new Hook(joinPtr, new JoinPfDelegate(this.JoinPfDetour)); - this.JoinPfHook.Enable(); + if (this.JoinsEnabled && scanner.TryScanText(Signatures.JoinCrossParty, out var joinPtr, "Party Finder joins")) { + this.JoinPfHook = new Hook(joinPtr, new JoinPfDelegate(this.JoinPfDetour)); + this.JoinPfHook.Enable(); - this.PartyFinderGui.ReceiveListing += this.ReceiveListing; - } + this.PartyFinderGui.ReceiveListing += this.ReceiveListing; } } /// public void Dispose() { - if (this.JoinsEnabled) { - this.PartyFinderGui.ReceiveListing -= this.ReceiveListing; - } - + this.PartyFinderGui.ReceiveListing -= this.ReceiveListing; this.JoinPfHook?.Dispose(); this.RequestPfListingsHook?.Dispose(); }