return false;
}
- _logger.LogWarning("Client {Name} ({Id}) was caught cheating: [{Context}-{Category}] {Message}", Name, Id, context.Name, category, message);
+ var supportCode = Random.Shared.Next(0, 999_999).ToString("000-000");
+
+ _logger.LogWarning("Client {Name} ({Id}) was caught cheating: [{SupportCode}] [{Context}-{Category}] {Message}", Name, Id, supportCode, context.Name, category, message);
if (_antiCheatConfig.BanIpFromGame)
{
Player?.Game.BanIp(Connection.EndPoint.Address);
}
- await DisconnectAsync(DisconnectReason.Hacking, context.Name + ": " + message);
+ var disconnectMessage =
+ $"""
+ You have been caught cheating and were {(_antiCheatConfig.BanIpFromGame ? "banned" : "kicked")} from the lobby.
+ For questions, contact your server admin and share the following code: {supportCode}.
+ """;
+
+ await DisconnectAsync(DisconnectReason.Custom, disconnectMessage);
return true;
}