Skip to content

Commit de1185e

Browse files
committed
ConcurrentDictionary
1 parent a2c610a commit de1185e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ASFAchievementManager/ASFAchievementManager.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
using JetBrains.Annotations;
99
using SteamKit2;
1010
using System.Linq;
11+
using System.Collections.Concurrent;
1112

1213
namespace ASFAchievementManager {
1314
[Export(typeof(IPlugin))]
1415
public sealed class ASFAchievementManager : IBotSteamClient, IBotMessage, IBotCommand {
15-
private static Dictionary<Bot, AchievementHandler> AchievementHandlers = new Dictionary<Bot, AchievementHandler>();
16+
private static ConcurrentDictionary<Bot, AchievementHandler> AchievementHandlers = new ConcurrentDictionary<Bot, AchievementHandler>();
1617
public string Name => "ASF Achievement Manager";
1718
public Version Version => typeof(ASFAchievementManager).Assembly.GetName().Version;
1819

@@ -66,7 +67,7 @@ public void OnBotSteamCallbacksInit([NotNull] Bot bot, [NotNull] CallbackManager
6667

6768
public IReadOnlyCollection<ClientMsgHandler> OnBotSteamHandlersInit([NotNull] Bot bot) {
6869
AchievementHandler CurrentBotAchievementHandler = new AchievementHandler();
69-
AchievementHandlers.Add(bot, CurrentBotAchievementHandler);
70+
AchievementHandlers.TryAdd(bot, CurrentBotAchievementHandler);
7071
return new HashSet<ClientMsgHandler> { CurrentBotAchievementHandler };
7172
}
7273

0 commit comments

Comments
 (0)