Skip to content

Commit

Permalink
Revert protocol-states being used for 1.8 - 1.20.1 packet class to pa…
Browse files Browse the repository at this point in the history
…cket type translation (#2961)
  • Loading branch information
Jpx3 authored Jun 3, 2024
1 parent b0c4b7f commit 1325ec6
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Class<?>, PacketType> classToTypesForProtocol = REGISTER.protocolClassToType.get(protocol);
return classToTypesForProtocol == null ? null : classToTypesForProtocol.get(packet);
}
Expand Down

0 comments on commit 1325ec6

Please sign in to comment.