Simplified calls to .Remove()

This commit is contained in:
Chomp
2025-07-14 20:02:46 +01:00
parent 5ef2271a29
commit 6f3ce60cec
4 changed files with 4 additions and 18 deletions
@@ -434,7 +434,7 @@ public class DialogueController(
public virtual void RemoveDialogue(string? dialogueId, MongoId sessionId)
{
var profile = saveServer.GetProfile(sessionId);
if (!profile.DialogueRecords.ContainsKey(dialogueId))
if (!profile.DialogueRecords.Remove(dialogueId))
{
logger.Error(
serverLocalisationService.GetText(
@@ -442,11 +442,7 @@ public class DialogueController(
new { sessionId, dialogueId }
)
);
return;
}
profile.DialogueRecords.Remove(dialogueId);
}
/// <summary>
@@ -722,10 +722,7 @@ public class InventoryController(
)
{
// Remove link
if (pmcData.Inventory.FastPanel.ContainsKey(bindRequest.Index))
{
pmcData.Inventory.FastPanel.Remove(bindRequest.Index);
}
pmcData.Inventory.FastPanel.Remove(bindRequest.Index);
// Create link between fast panel slot and requested item
pmcData.Inventory.FastPanel[bindRequest.Index] = bindRequest.Item;
@@ -113,10 +113,7 @@ public class GiveSptCommand(
else
{
// A new give request was entered, we need to ignore the old saved command
if (_savedCommand.ContainsKey(sessionId))
{
_savedCommand.Remove(sessionId);
}
_savedCommand.Remove(sessionId);
isItemName = (!string.IsNullOrEmpty(result.Groups[5].Value));
item =
@@ -1,6 +1,5 @@
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Text.Json;
using System.Text.Json.Nodes;
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.DI;
@@ -52,10 +51,7 @@ public class SaveServer(
/// <param name="id"> ID of Callback to remove </param>
public void RemoveBeforeSaveCallback(string id)
{
if (onBeforeSaveCallbacks.ContainsKey(id))
{
onBeforeSaveCallbacks.Remove(id);
}
onBeforeSaveCallbacks.Remove(id);
}
/// <summary>