mirror of
https://github.com/ViaVersion/ViaForge.git
synced 2024-11-22 12:05:23 +01:00
Set VFNetworkManager in commons injector
This commit is contained in:
parent
76e8ec8baa
commit
fd1b080728
@ -89,12 +89,14 @@ public class ViaForgeCommon {
|
||||
*
|
||||
* @param channel the channel to inject the pipeline into
|
||||
*/
|
||||
public void inject(final Channel channel) {
|
||||
public void inject(final Channel channel, final VFNetworkManager networkManager) {
|
||||
if (channel instanceof SocketChannel) {
|
||||
final UserConnection user = new UserConnectionImpl(channel, true);
|
||||
new ProtocolPipelineImpl(user);
|
||||
|
||||
channel.attr(LOCAL_VIA_USER).set(user);
|
||||
channel.attr(VF_NETWORK_MANAGER).set(networkManager);
|
||||
|
||||
channel.pipeline().addLast(new ViaForgeVLLegacyPipeline(user, targetVersion));
|
||||
}
|
||||
}
|
||||
|
@ -35,12 +35,6 @@ public class MixinNetworkManager_5 {
|
||||
|
||||
@Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
|
||||
private void onInitChannel(Channel channel, CallbackInfo ci) {
|
||||
// We need to access this class later to call the viaforge_setupPreNettyDecryption method.
|
||||
// In one of the ViaLegacy's required providers, so we track this class instance as an own
|
||||
// attribute in the connection and later access it from there and remove it.
|
||||
// Counterpart in {@link java/de/florianmichael/viaforge/common/protocolhack/provider/ViaForgeEncryptionProvider.java}
|
||||
channel.attr(ViaForgeCommon.VF_NETWORK_MANAGER).set((VFNetworkManager) val$networkmanager);
|
||||
|
||||
ViaForgeCommon.getManager().inject(channel);
|
||||
ViaForgeCommon.getManager().inject(channel, (VFNetworkManager) val$networkmanager);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user