Skip to content

Commit 564349c

Browse files
nickucdmulloy2
authored andcommitted
Fallback to the HANDSHAKING protocol if no packet type is found in the registry (fixes #2601)
1 parent 0da2751 commit 564349c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main/java/com/comphenix/protocol/injector/netty/manager/NetworkManagerInjector.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,15 @@ public PacketEvent onPacketReceiving(Injector injector, Object packet, NetworkMa
112112
if (marker != null || inboundListeners.contains(packetClass)) {
113113
// wrap the packet and construct the event
114114
PacketType.Protocol currentProtocol = injector.getCurrentProtocol(PacketType.Sender.CLIENT);
115-
PacketContainer container = new PacketContainer(PacketRegistry.getPacketType(currentProtocol, packetClass), packet);
115+
PacketType packetType = PacketRegistry.getPacketType(currentProtocol, packetClass);
116+
117+
// if packet type could not be found, fallback to HANDSHAKING protocol
118+
// temporary workaround for https://github.com/dmulloy2/ProtocolLib/issues/2601
119+
if (packetType == null) {
120+
packetType = PacketRegistry.getPacketType(PacketType.Protocol.HANDSHAKING, packetClass);
121+
}
122+
123+
PacketContainer container = new PacketContainer(packetType, packet);
116124
PacketEvent packetEvent = PacketEvent.fromClient(this, container, marker, injector.getPlayer());
117125

118126
// post to all listeners, then return the packet event we constructed

0 commit comments

Comments
 (0)