Skip to content

Commit

Permalink
Fixed "protocollib_encoder" attempting to read non-nms packets (#959)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
terminalsin authored Dec 23, 2020
1 parent bbb053a commit 2b22999
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ public void write(ChannelHandlerContext ctx, Object packet, ChannelPromise promi
super.write(ctx, packet, promise);
ChannelInjector.this.finalWrite();
}

@Override
public boolean acceptOutboundMessage(Object msg) {
return msg instanceof WirePacket || MinecraftReflection.getPacketClass().isAssignableFrom(msg.getClass());
}
};

// Intercept recieved packets
Expand Down Expand Up @@ -895,6 +900,8 @@ public void close() {
}
}



/**
* Execute a specific command in the channel thread.
* <p>
Expand Down

0 comments on commit 2b22999

Please sign in to comment.