mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2025-02-20 06:22:18 +01:00
Fallback to the HANDSHAKING protocol if no packet type is found in the registry (fixes https://github.com/dmulloy2/ProtocolLib/issues/2601)
This commit is contained in:
parent
0da27515a4
commit
564349c914
@ -112,7 +112,15 @@ public class NetworkManagerInjector implements ChannelListener {
|
||||
if (marker != null || inboundListeners.contains(packetClass)) {
|
||||
// wrap the packet and construct the event
|
||||
PacketType.Protocol currentProtocol = injector.getCurrentProtocol(PacketType.Sender.CLIENT);
|
||||
PacketContainer container = new PacketContainer(PacketRegistry.getPacketType(currentProtocol, packetClass), packet);
|
||||
PacketType packetType = PacketRegistry.getPacketType(currentProtocol, packetClass);
|
||||
|
||||
// if packet type could not be found, fallback to HANDSHAKING protocol
|
||||
// temporary workaround for https://github.com/dmulloy2/ProtocolLib/issues/2601
|
||||
if (packetType == null) {
|
||||
packetType = PacketRegistry.getPacketType(PacketType.Protocol.HANDSHAKING, packetClass);
|
||||
}
|
||||
|
||||
PacketContainer container = new PacketContainer(packetType, packet);
|
||||
PacketEvent packetEvent = PacketEvent.fromClient(this, container, marker, injector.getPlayer());
|
||||
|
||||
// post to all listeners, then return the packet event we constructed
|
||||
|
Loading…
Reference in New Issue
Block a user