public const string NotImplemented = "Game listing has not been implemented in Impostor yet for servers " +
"running in server redirection mode.";
+
+ public const string UsernameLength = "Your username is too long, please make it shorter.";
}
}
\ No newline at end of file
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
+using Impostor.Server.Data;
using Impostor.Server.Net.Factories;
using Impostor.Server.Net.Messages;
using Impostor.Shared.Innersloth;
public async ValueTask RegisterConnectionAsync(IConnection connection, string name, int clientVersion)
{
+ if (name.Length > 10)
+ {
+ using var packet = connection.CreateMessage(MessageType.Reliable);
+ Message01JoinGame.SerializeError(packet, false, DisconnectReason.Custom, DisconnectMessages.UsernameLength);
+ await packet.SendAsync();
+ return;
+ }
+
if (!SupportedVersions.Contains(clientVersion))
{
using var packet = connection.CreateMessage(MessageType.Reliable);
public enum DisconnectReason
{
ExitGame = 0,
- Destroy = 16,
// The game you tried to join is full.
// Check with the host to see if you can join next round.
GameFull = 1,
// You can rejoin if the room hasn't started
// You were kicked
Kicked = 7,
- // Server refused username: %USERNAME%
- InvalidName = 9,
// You were banned for hacking.
// Please stop.
Hacking = 10,
+ Destroy = 16,
// You disconnected from the host.
// If this happens often, check your WiFi strength.
//