public void Handle(NetworkClient client) { client.CS.LoginName = Name; client.CS.MpPass = Motd; if (ProtocolVersion != 7) { ServerCore.Logger.Log("Handshake", "Disconnecting client '" + Name + "'. Unsupported protocol verison (" + ProtocolVersion + ")", LogType.Info); client.KickPlayer("Unsupported protocol version."); return; } if (!ServerCore.Hb.VerifyClientName(client)) { ServerCore.Logger.Log("Handshake", "Disconnecting client '" + Name + "'. Failed to verify name.", LogType.Info); client.KickPlayer("Name verification incorrect."); return; } if (Text.StringMatches(Name)) { ServerCore.Logger.Log("Handshake", "Disconnecting Client '" + Name + "'. Invalid characters in name.", LogType.Info); client.KickPlayer("Invalid characters in name."); return; } if (Name == "") { ServerCore.Logger.Log("Handshake", "Disconnecting Client '" + Name + "'. Invalid name.", LogType.Info); client.KickPlayer("Invalid name."); return; } if (ServerCore.OnlinePlayers > ServerCore.Nh.MaxPlayers) { client.KickNow("The server is full."); return; } client.CS.MpPass = Motd; if (Usertype == 66) { // -- CPE Client ServerCore.Logger.Log("Handshake", "CPE Client Detected.", LogType.Info); client.CS.CPE = true; CPE.CPEHandshake(client); return; } // -- Normal Client. client.CS.CPE = false; client.Login(); }
/// <summary> /// Sends additional pre-login packets after receiving a client's supported extensions. /// </summary> /// <param name="client"></param> public static void CPEPackets(NetworkClient client) { if (client.CS.CPEExtensions.ContainsKey("ClickDistance")) { var distance = new SetClickDistance {Distance = (short) ServerCore.ClickDistance}; client.SendQueue.Enqueue(distance); } if (client.CS.CPEExtensions.ContainsKey("CustomBlocks")) { var cbsl = new CustomBlockSupportLevel {SupportLevel = CustomBlocksSupportLevel}; client.SendQueue.Enqueue(cbsl); } else client.Login(); }
public void Handle(NetworkClient client) { client.CS.CustomBlocksLevel = SupportLevel; client.Login(); }