Revert protocol-states being used for 1.8 - 1.20.1 packet class to packet type translation (#2961)

This commit is contained in:
Richy 2024-06-03 05:27:49 +02:00 committed by GitHub
parent b0c4b7fe45
commit 1325ec6a98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -712,6 +712,15 @@ public class PacketRegistry {
return PacketType.Play.Server.BUNDLE;
}
/*
* Reverts https://github.com/dmulloy2/ProtocolLib/pull/2568 for server versions 1.8 to 1.20.1.
*
* Since packet classes are not shared for these versions,
* the protocol state is not needed to determine the packet type from class.
*/
if (!MinecraftVersion.CONFIG_PHASE_PROTOCOL_UPDATE.atOrAbove()) {
return getPacketType(packet);
}
Map<Class<?>, PacketType> classToTypesForProtocol = REGISTER.protocolClassToType.get(protocol);
return classToTypesForProtocol == null ? null : classToTypesForProtocol.get(packet);
}