// Generated by delombok at Tue Dec 16 19:36:13 UTC 2025
package net.md_5.bungee.netty.cipher;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageDecoder;
import java.util.List;
import net.md_5.bungee.jni.cipher.BungeeCipher;

public class CipherDecoder extends MessageToMessageDecoder<ByteBuf> {
    private final BungeeCipher cipher;

    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
        out.add(cipher.cipher(ctx, msg));
    }

    @Override
    public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
        cipher.free();
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public CipherDecoder(final BungeeCipher cipher) {
        this.cipher = cipher;
    }
}
