Fix finding player network channel with Protocollib and Floodgate

This resolves the deleted ProtocolLib method for newer builds, but uses
reflection to find the channel despite the variable name.

Fixes #1216
This commit is contained in:
games647
2024-07-08 12:38:10 +02:00
parent 51efb9d62d
commit 4dd6b9ade4

View File

@ -304,7 +304,7 @@ public class ProtocolLibListener extends PacketAdapter {
NettyChannelInjector injector = (NettyChannelInjector) Accessors.getMethodAccessorOrNull(
TemporaryPlayerFactory.class, "getInjectorFromPlayer", Player.class
).invoke(null, player);
return injector.getWrappedChannel();
return FuzzyReflection.getFieldValue(injector, Channel.class, true);
}
/**