mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-27 13:15:52 +01:00
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.
This commit is contained in:
parent
bbb053aa4e
commit
2b22999b94
@ -271,6 +271,11 @@ public class ChannelInjector extends ByteToMessageDecoder implements Injector {
|
|||||||
super.write(ctx, packet, promise);
|
super.write(ctx, packet, promise);
|
||||||
ChannelInjector.this.finalWrite();
|
ChannelInjector.this.finalWrite();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean acceptOutboundMessage(Object msg) {
|
||||||
|
return msg instanceof WirePacket || MinecraftReflection.getPacketClass().isAssignableFrom(msg.getClass());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Intercept recieved packets
|
// Intercept recieved packets
|
||||||
@ -895,6 +900,8 @@ public class ChannelInjector extends ByteToMessageDecoder implements Injector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a specific command in the channel thread.
|
* Execute a specific command in the channel thread.
|
||||||
* <p>
|
* <p>
|
||||||
|
Loading…
Reference in New Issue
Block a user