Skip to content

Commit f6816d3

Browse files
committed
Updated to the latest game version
1 parent af8a84c commit f6816d3

3 files changed

Lines changed: 12 additions & 11 deletions

File tree

LabExtended/API/ExPlayer.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using CentralAuth;
1+
using System.Collections.Concurrent;
2+
using CentralAuth;
23

34
using CommandSystem;
45

@@ -83,9 +84,9 @@ namespace LabExtended.API;
8384
/// </summary>
8485
public class ExPlayer : Player, IDisposable
8586
{
87+
internal static volatile ConcurrentDictionary<string, string> preauthData = new();
88+
8689
internal static PlayerUpdateComponent playerUpdate = PlayerUpdateComponent.Create();
87-
88-
internal static Dictionary<string, string> preauthData = new(byte.MaxValue);
8990
internal static ExPlayer? host;
9091

9192
/// <summary>
@@ -524,10 +525,10 @@ public ExPlayer(ReferenceHub referenceHub, SwitchContainer toggles) : base(refer
524525
Toggles = toggles ?? throw new ArgumentNullException(nameof(toggles));
525526

526527
if (referenceHub.connectionToClient != null &&
527-
LiteNetLib4MirrorServer.Peers.TryPeekIndex(referenceHub.connectionToClient.connectionId, out var peer))
528+
LiteNetLib4MirrorServer.Peers.TryGetValue(referenceHub.connectionToClient.connectionId, out var peer))
528529
Peer = peer;
529530
else if (referenceHub.connectionToServer != null &&
530-
LiteNetLib4MirrorServer.Peers.TryPeekIndex(referenceHub.connectionToServer.connectionId, out peer))
531+
LiteNetLib4MirrorServer.Peers.TryGetValue(referenceHub.connectionToServer.connectionId, out peer))
531532
Peer = peer;
532533

533534
infoBuilder = StringBuilderPool.Shared.Rent();
@@ -1515,7 +1516,7 @@ public void Dispose()
15151516
Players.Remove(this);
15161517

15171518
if (!string.IsNullOrWhiteSpace(UserId))
1518-
preauthData.Remove(UserId);
1519+
preauthData.TryRemove(UserId, out _);
15191520

15201521
AllPlayers.ForEach(ply =>
15211522
{

LabExtended/Core/ApiVersion.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static class ApiVersion
2525
/// <summary>
2626
/// The patch version part.
2727
/// </summary>
28-
public const int Patch = 0;
28+
public const int Patch = 1;
2929

3030
/// <summary>
3131
/// Gets the loader's current version.
@@ -40,7 +40,7 @@ public static class ApiVersion
4040
/// <summary>
4141
/// Gets the loader's game version compatibility.
4242
/// </summary>
43-
public static VersionRange? Compatibility { get; } = new VersionRange(new(14, 2, 5));
43+
public static VersionRange? Compatibility { get; } = new VersionRange(new(14, 2, 6));
4444

4545
/// <summary>
4646
/// Checks for server version compatibility.

LabExtended/Events/InternalEvents.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,14 @@ private static void HandleSpawning(PlayerSpawningEventArgs args)
166166

167167
private static void HandleRoleChange(PlayerChangedRoleEventArgs args)
168168
=> OnRoleChanged.InvokeSafe(args);
169-
169+
170170
private static void HandlePlayerAuth(PlayerPreAuthenticatingEventArgs ev)
171-
=> ExPlayer.preauthData[ev.UserId] = ev.Region;
171+
=> ExPlayer.preauthData.TryAdd(ev.UserId, ev.Region);
172172

173173
private static void HandleRoundWaiting()
174174
{
175175
ExPlayer.playerUpdate.Clear();
176-
ExPlayer.preauthData.Clear();
176+
ExPlayer.preauthData.Clear();
177177

178178
// No reason not to reset the NPC connection ID
179179
DummyNetworkConnection._idGenerator = ushort.MaxValue;

0 commit comments

Comments
 (0)