mirror of
https://github.com/ViaVersion/ViaForge.git
synced 2024-11-29 13:15:13 +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
|
* @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) {
|
if (channel instanceof SocketChannel) {
|
||||||
final UserConnection user = new UserConnectionImpl(channel, true);
|
final UserConnection user = new UserConnectionImpl(channel, true);
|
||||||
new ProtocolPipelineImpl(user);
|
new ProtocolPipelineImpl(user);
|
||||||
|
|
||||||
channel.attr(LOCAL_VIA_USER).set(user);
|
channel.attr(LOCAL_VIA_USER).set(user);
|
||||||
|
channel.attr(VF_NETWORK_MANAGER).set(networkManager);
|
||||||
|
|
||||||
channel.pipeline().addLast(new ViaForgeVLLegacyPipeline(user, targetVersion));
|
channel.pipeline().addLast(new ViaForgeVLLegacyPipeline(user, targetVersion));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,12 +35,6 @@ public class MixinNetworkManager_5 {
|
|||||||
|
|
||||||
@Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
|
@Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
|
||||||
private void onInitChannel(Channel channel, CallbackInfo ci) {
|
private void onInitChannel(Channel channel, CallbackInfo ci) {
|
||||||
// We need to access this class later to call the viaforge_setupPreNettyDecryption method.
|
ViaForgeCommon.getManager().inject(channel, (VFNetworkManager) val$networkmanager);
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user