From 72df87df70818e0073cb293513d120e0bb31a89d Mon Sep 17 00:00:00 2001 From: Richard Date: Sun, 2 Jun 2024 23:49:38 +0200 Subject: [PATCH] Revert protocol-states being used for 1.8 - 1.20.1 packet class to packet type translation --- .../protocol/injector/packet/PacketRegistry.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/comphenix/protocol/injector/packet/PacketRegistry.java b/src/main/java/com/comphenix/protocol/injector/packet/PacketRegistry.java index f422efb1b..49b2d4dda 100644 --- a/src/main/java/com/comphenix/protocol/injector/packet/PacketRegistry.java +++ b/src/main/java/com/comphenix/protocol/injector/packet/PacketRegistry.java @@ -712,6 +712,15 @@ public static PacketType getPacketType(PacketType.Protocol protocol, Class pa 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, PacketType> classToTypesForProtocol = REGISTER.protocolClassToType.get(protocol); return classToTypesForProtocol == null ? null : classToTypesForProtocol.get(packet); }