Skip to content

Commit 2b22999

Browse files
authored
Fixed "protocollib_encoder" attempting to read non-nms packets (#959)
Added an override to the encoder as such would process any non-wire packets as NMS packets. In the case of the use of different APIs, such as Artemis Packet API, such would cause a conflict and would spit out casting exceptions. It is quite easy to resolve by exclusively accepting Wire Packets and packets which are assignable to the packet class. This solves the issue and tada happy ending.
1 parent bbb053a commit 2b22999

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/main/java/com/comphenix/protocol/injector/netty/ChannelInjector.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,11 @@ public void write(ChannelHandlerContext ctx, Object packet, ChannelPromise promi
271271
super.write(ctx, packet, promise);
272272
ChannelInjector.this.finalWrite();
273273
}
274+
275+
@Override
276+
public boolean acceptOutboundMessage(Object msg) {
277+
return msg instanceof WirePacket || MinecraftReflection.getPacketClass().isAssignableFrom(msg.getClass());
278+
}
274279
};
275280

276281
// Intercept recieved packets
@@ -895,6 +900,8 @@ public void close() {
895900
}
896901
}
897902

903+
904+
898905
/**
899906
* Execute a specific command in the channel thread.
900907
* <p>

0 commit comments

Comments
 (0)