Refactor inventory event lookup logic
Replaced ContainsKey and indexer access with TryGetValue for InventoryEvents dictionary to improve performance and readability in EventsService.
This commit is contained in:
parent
04b4e872a8
commit
7411ba3268
1 changed files with 2 additions and 2 deletions
|
|
@ -33,9 +33,9 @@ namespace SecondBotEvents.Services
|
|||
{
|
||||
|
||||
detail["itemtype"] = detail["itemtype"].ToLower().FirstCharToUpper();
|
||||
if (InventoryEvents.ContainsKey(detail["itemtype"]) == true)
|
||||
if (InventoryEvents.TryGetValue(detail["itemtype"], out var targets))
|
||||
{
|
||||
foreach (string A in InventoryEvents[detail["itemtype"]])
|
||||
foreach (string A in targets)
|
||||
{
|
||||
string output = JsonSerializer.Serialize(detail);
|
||||
if (UUID.TryParse(A, out UUID OutputAvatar) == true)
|
||||
|
|
|
|||
Loading…
Reference in a new issue