public override async Task PopulateAsync()
        {
            using (var stream = new MinecraftStream(this.PacketData))
            {
                var secretLength = await stream.ReadVarIntAsync();

                this.SharedSecret = await stream.ReadUInt8ArrayAsync(secretLength);

                var tokenLength = await stream.ReadVarIntAsync();

                this.VerifyToken = await stream.ReadUInt8ArrayAsync(tokenLength);
            }
        }
        public override async Task PopulateAsync()
        {
            using (var stream = new MinecraftStream(this.PacketData))
            {
                this.ServerId = await stream.ReadStringAsync() ?? string.Empty;

                var keyLength = await stream.ReadVarIntAsync();

                this.PublicKey = await stream.ReadUInt8ArrayAsync(keyLength);

                var tokenLength = await stream.ReadVarIntAsync();

                this.VerifyToken = await stream.ReadUInt8ArrayAsync(tokenLength);
            }
        }
Exemple #3
0
        public async Task ReadAsync(MinecraftStream stream)
        {
            this.Channel = await stream.ReadStringAsync();

            var length = stream.Length - stream.Position;

            this.PluginData = await stream.ReadUInt8ArrayAsync((int)length);
        }
Exemple #4
0
        public static async Task <Packet> ReadCompressedPacketAsync(MinecraftStream stream)
        {
            var packetLength = await stream.ReadVarIntAsync();

            var dataLength = await stream.ReadVarIntAsync();

            using var deStream = new MinecraftStream(new ZlibStream(stream, SharpCompress.Compressors.CompressionMode.Decompress, CompressionLevel.BestSpeed));

            var packetId = await deStream.ReadVarIntAsync();

            var packetData = await deStream.ReadUInt8ArrayAsync(dataLength - packetId.GetVarIntLength());

            return(new Packet(packetId, packetData));
        }
Exemple #5
0
        public async Task ReadAsync(MinecraftStream stream)
        {
            this.Channel = await stream.ReadStringAsync();

            this.PluginData = await stream.ReadUInt8ArrayAsync();
        }