check send packet
This commit is contained in:
@@ -10,15 +10,17 @@ import mc.protocol.State;
|
||||
import mc.protocol.io.NetByteBuf;
|
||||
import mc.protocol.packets.ServerSidePacket;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
public class ProtocolEncoder extends MessageToByteEncoder<ServerSidePacket> {
|
||||
|
||||
@Override
|
||||
protected void encode(ChannelHandlerContext ctx, ServerSidePacket packet, ByteBuf out) {
|
||||
State state = ctx.channel().attr(NetworkAttributes.STATE).get();
|
||||
int packetId = Objects.requireNonNull(state.getServerSidePacketId(packet.getClass()));
|
||||
Integer packetId = state.getServerSidePacketId(packet.getClass());
|
||||
if (packetId == null) {
|
||||
log.error("Unknown send packet: State {} ; Class {}", state, packet.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
log.debug("OUT: {}:{}", state, packet);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user