Fix 1.20.1-1.20.2 support

This commit is contained in:
RayzsYT committed 2024-05-29 01:11:08 +02:00
1 parent c02be74b43
commit 53da79ae53
1 file changed
+1 -1
@@ -239,7 +239,7 @@ public class Reflection {
}
public static Object getPlayerNetworkManager(Object playerConnection) throws Exception {
Optional<Field> optional = getFieldsByType(Reflection.getMinor() > 19 ? playerConnection.getClass().getSuperclass() : playerConnection.getClass(), "NetworkManager", SearchOption.ENDS).stream().findFirst();
Optional<Field> optional = getFieldsByType(Reflection.getMinor() == 20 && Reflection.getRelease() > 2 || Reflection.getMinor() > 20 ? playerConnection.getClass().getSuperclass() : playerConnection.getClass(), "NetworkManager", SearchOption.ENDS).stream().findFirst();
if(!optional.isPresent()) return null;
return optional.get().get(playerConnection);
}