package com.game_machine.core; import static io.netty.buffer.Unpooled.wrappedBuffer; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToMessageEncoder; import java.util.List; import GameMachine.Messages.ClientMessage; public class ClientMessageEncoder extends MessageToMessageEncoder { @Override protected void encode(ChannelHandlerContext ctx, ClientMessage msg, List out) throws Exception { if (msg instanceof ClientMessage) { out.add(wrappedBuffer(msg.toPrefixedByteArray())); return; } } }