Skip to content

Commit 73846c4

Browse files
authored
fix: PostAdminCheck for bot (#56)
* ✈️ * OnAdminCacheReload
1 parent 4c2e239 commit 73846c4

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

Sharp.Core/Managers/ClientManager.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -384,15 +384,13 @@ private void OnGameFramePost(bool simulating, bool first, bool last)
384384

385385
if (client.IsAuthenticated)
386386
{
387-
var c = client;
388-
389387
var block = false;
390388

391389
for (var i = 0; i < _listeners.Count; i++)
392390
{
393391
try
394392
{
395-
if (_listeners[i].OnClientPreAdminCheck(c))
393+
if (_listeners[i].OnClientPreAdminCheck(client))
396394
{
397395
block = true;
398396
}
@@ -408,29 +406,31 @@ private void OnGameFramePost(bool simulating, bool first, bool last)
408406

409407
if (block)
410408
{
411-
_logger.LogWarning("Blocked {client}<{steamId}> as AdminCheck", c.Name, c.SteamId);
409+
_logger.LogTrace("Blocked {client}<{steamId}> as AdminCheck", client.Name, client.SteamId);
412410

413411
continue;
414412
}
415-
416-
for (var i = 0; i < _listeners.Count; i++)
417-
{
418-
try
419-
{
420-
_listeners[i].OnClientPostAdminCheck(c);
421-
}
422-
catch (Exception e)
423-
{
424-
_logger.LogError(e,
425-
"An error occurred while calling listener<{s}> {name}",
426-
"OnClientPostAdminCheck",
427-
_listeners[i].GetType().Name);
428-
}
429-
}
430413
}
431-
else
414+
else if (!client.IsFakeClient)
432415
{
433416
back.Add(client);
417+
418+
continue;
419+
}
420+
421+
for (var i = 0; i < _listeners.Count; i++)
422+
{
423+
try
424+
{
425+
_listeners[i].OnClientPostAdminCheck(client);
426+
}
427+
catch (Exception e)
428+
{
429+
_logger.LogError(e,
430+
"An error occurred while calling listener<{s}> {name}",
431+
"OnClientPostAdminCheck",
432+
_listeners[i].GetType().Name);
433+
}
434434
}
435435
}
436436

0 commit comments

Comments
 (0)