fix: Fixes extension method refactors causing crash (#1529)

This commit is contained in:
Kamron Batman 2023-10-02 22:24:16 -07:00 • committed by GitHub
parent f2de2fbb77
commit e18115dd94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 5 deletions

View file

@ -132,11 +132,24 @@ public class PlayerMurderSystem : GenericPersistence
}
}
public static bool GetMurderContext(PlayerMobile player, out MurderContext context) =>
_murderContexts.TryGetValue(player, out context);
public static bool GetMurderContext(PlayerMobile player, out MurderContext context)
{
if (player != null && _murderContexts.TryGetValue(player, out context))
{
return true;
}
context = null;
return false;
}
public static MurderContext GetOrCreateMurderContext(PlayerMobile player)
{
if (player == null)
{
return null;
}
ref var context = ref CollectionsMarshal.GetValueRefOrAddDefault(_murderContexts, player, out var exists);
if (!exists)
{