Skip to content

Commit

Permalink
Better receiveUpstream
Browse files Browse the repository at this point in the history
  • Loading branch information
bundabrg committed Aug 12, 2020
1 parent 1511ff1 commit b243659
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -628,15 +628,11 @@ public void sendUpstreamPacket(BedrockPacket packet) {
/**
* Inject a packet as if it was received by the upstream client
* @param packet the bedrock packet to be injected
* @return true if handled
*/
@SuppressWarnings("unused")
public void receiveUpstreamPacket(BedrockPacket packet) {
try {
Method handle = getUpstream().getSession().getPacketHandler().getClass().getMethod("handle", packet.getClass());
handle.invoke(getUpstream().getSession().getPacketHandler(), packet);
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
connector.getLogger().error("Tried to inject upstream packet " + packet + " but it is not handled");
}
public boolean receiveUpstreamPacket(BedrockPacket packet) {
return packet.handle(getUpstream().getSession().getPacketHandler());
}

/**
Expand Down

0 comments on commit b243659

Please sign in to comment.