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