Ejemplo n.º 1
0
        public ValueTask SendAsync(IInnerPlayerControl player, string text, IClient?targetClient = null)
        {
            var data = _writerProvider.Get();

            Serialize(data, text);
            return(base.SendAsync(player, data, targetClient?.Id ?? null));
        }
        public async ValueTask OnClientConnectedEventAsync(IClientConnectedEvent e)
        {
            var clientInfo = e.Connection.GetReactor();

            if (clientInfo == null)
            {
                return;
            }

            if (clientInfo.Version < ReactorProtocolVersion.Initial || clientInfo.Version > ReactorProtocolVersion.Latest)
            {
                await e.Client.DisconnectAsync(DisconnectReason.Custom, "Unsupported Reactor.Networking protocol version");

                return;
            }

            using var writer = _messageWriterProvider.Get(MessageType.Reliable);
            ModdedHandshakeS2C.Serialize(writer, "Impostor", _serverEnvironment.Version, 0);
            await e.Connection.SendAsync(writer);
        }