mirror of
https://github.com/ViaVersion/ViaLoader.git
synced 2024-11-22 11:48:26 +01:00
Fixed potential issues when using ViaLoader serverside
This commit is contained in:
parent
83462d813d
commit
b0de353c82
@ -62,7 +62,7 @@ repositories {
|
||||
```
|
||||
Here is an example dependency configuration for all components:
|
||||
```groovy
|
||||
implementation "com.viaversion:viaversion:5.0.4"
|
||||
implementation "com.viaversion:viaversion:5.0.5"
|
||||
implementation "com.viaversion:viabackwards-common:5.0.4"
|
||||
implementation "com.viaversion:viarewind-common:4.0.3"
|
||||
implementation "net.raphimc:ViaLegacy:3.0.3"
|
||||
|
@ -50,7 +50,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly "com.viaversion:viaversion-common:5.0.4"
|
||||
compileOnly "com.viaversion:viaversion-common:5.0.5"
|
||||
compileOnly "com.viaversion:viabackwards-common:5.0.4"
|
||||
compileOnly "com.viaversion:viarewind-common:4.0.3"
|
||||
compileOnly "net.raphimc:ViaLegacy:3.0.3"
|
||||
|
@ -51,7 +51,6 @@ public abstract class VLLegacyPipeline extends ChannelInboundHandlerAdapter {
|
||||
this(user, Via.getManager().getProviders().get(VersionProvider.class).getServerProtocol(user));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public VLLegacyPipeline(final UserConnection user, final ProtocolVersion version) {
|
||||
this.user = user;
|
||||
this.version = version;
|
||||
@ -62,16 +61,18 @@ public abstract class VLLegacyPipeline extends ChannelInboundHandlerAdapter {
|
||||
ctx.pipeline().addBefore(this.packetDecoderName(), VIA_DECODER_NAME, this.createViaDecoder());
|
||||
ctx.pipeline().addBefore(this.packetEncoderName(), VIA_ENCODER_NAME, this.createViaEncoder());
|
||||
|
||||
final ProtocolVersion r1_6_4 = ProtocolVersion.getProtocol(VersionType.RELEASE_INITIAL, 78);
|
||||
if (r1_6_4.isKnown() && this.version.olderThanOrEqualTo(r1_6_4)) {
|
||||
ctx.pipeline().addBefore(this.lengthSplitterName(), VIALEGACY_PRE_NETTY_LENGTH_PREPENDER_NAME, this.createViaLegacyPreNettyLengthPrepender());
|
||||
ctx.pipeline().addBefore(this.lengthPrependerName(), VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, this.createViaLegacyPreNettyLengthRemover());
|
||||
} else if (this.version.getName().startsWith("Bedrock")) {
|
||||
ctx.pipeline().addBefore(this.lengthSplitterName(), VIABEDROCK_DISCONNECT_HANDLER_NAME, this.createViaBedrockDisconnectHandler());
|
||||
ctx.pipeline().addBefore(this.lengthSplitterName(), VIABEDROCK_FRAME_ENCAPSULATION_HANDLER_NAME, this.createViaBedrockFrameEncapsulationHandler());
|
||||
this.replaceLengthSplitter(ctx, this.createViaBedrockBatchLengthCodec());
|
||||
ctx.pipeline().remove(this.lengthPrependerName());
|
||||
ctx.pipeline().addBefore(VIA_DECODER_NAME, VIABEDROCK_PACKET_ENCAPSULATION_HANDLER_NAME, this.createViaBedrockPacketEncapsulationHandler());
|
||||
if (this.user.isClientSide()) {
|
||||
final ProtocolVersion r1_6_4 = ProtocolVersion.getProtocol(VersionType.RELEASE_INITIAL, 78);
|
||||
if (r1_6_4.isKnown() && this.version.olderThanOrEqualTo(r1_6_4)) {
|
||||
ctx.pipeline().addBefore(this.lengthSplitterName(), VIALEGACY_PRE_NETTY_LENGTH_PREPENDER_NAME, this.createViaLegacyPreNettyLengthPrepender());
|
||||
ctx.pipeline().addBefore(this.lengthPrependerName(), VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, this.createViaLegacyPreNettyLengthRemover());
|
||||
} else if (this.version.getName().startsWith("Bedrock")) {
|
||||
ctx.pipeline().addBefore(this.lengthSplitterName(), VIABEDROCK_DISCONNECT_HANDLER_NAME, this.createViaBedrockDisconnectHandler());
|
||||
ctx.pipeline().addBefore(this.lengthSplitterName(), VIABEDROCK_FRAME_ENCAPSULATION_HANDLER_NAME, this.createViaBedrockFrameEncapsulationHandler());
|
||||
this.replaceLengthSplitter(ctx, this.createViaBedrockBatchLengthCodec());
|
||||
ctx.pipeline().remove(this.lengthPrependerName());
|
||||
ctx.pipeline().addBefore(VIA_DECODER_NAME, VIABEDROCK_PACKET_ENCAPSULATION_HANDLER_NAME, this.createViaBedrockPacketEncapsulationHandler());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,6 @@ public abstract class VLPipeline extends ChannelInboundHandlerAdapter {
|
||||
this(user, Via.getManager().getProviders().get(VersionProvider.class).getServerProtocol(user));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public VLPipeline(final UserConnection user, final ProtocolVersion version) {
|
||||
this.user = user;
|
||||
this.version = version;
|
||||
@ -59,14 +58,16 @@ public abstract class VLPipeline extends ChannelInboundHandlerAdapter {
|
||||
public void handlerAdded(ChannelHandlerContext ctx) {
|
||||
ctx.pipeline().addBefore(this.packetCodecName(), VIA_CODEC_NAME, this.createViaCodec());
|
||||
|
||||
final ProtocolVersion r1_6_4 = ProtocolVersion.getProtocol(VersionType.RELEASE_INITIAL, 78);
|
||||
if (r1_6_4.isKnown() && this.version.olderThanOrEqualTo(r1_6_4)) {
|
||||
ctx.pipeline().addBefore(this.lengthCodecName(), VIALEGACY_PRE_NETTY_LENGTH_CODEC_NAME, this.createViaLegacyPreNettyLengthCodec());
|
||||
} else if (this.version.getName().startsWith("Bedrock")) {
|
||||
ctx.pipeline().addBefore(this.lengthCodecName(), VIABEDROCK_DISCONNECT_HANDLER_NAME, this.createViaBedrockDisconnectHandler());
|
||||
ctx.pipeline().addBefore(this.lengthCodecName(), VIABEDROCK_FRAME_ENCAPSULATION_HANDLER_NAME, this.createViaBedrockFrameEncapsulationHandler());
|
||||
this.replaceLengthCodec(ctx, this.createViaBedrockBatchLengthCodec());
|
||||
ctx.pipeline().addBefore(VIA_CODEC_NAME, VIABEDROCK_PACKET_ENCAPSULATION_HANDLER_NAME, this.createViaBedrockPacketEncapsulationHandler());
|
||||
if (this.user.isClientSide()) {
|
||||
final ProtocolVersion r1_6_4 = ProtocolVersion.getProtocol(VersionType.RELEASE_INITIAL, 78);
|
||||
if (r1_6_4.isKnown() && this.version.olderThanOrEqualTo(r1_6_4)) {
|
||||
ctx.pipeline().addBefore(this.lengthCodecName(), VIALEGACY_PRE_NETTY_LENGTH_CODEC_NAME, this.createViaLegacyPreNettyLengthCodec());
|
||||
} else if (this.version.getName().startsWith("Bedrock")) {
|
||||
ctx.pipeline().addBefore(this.lengthCodecName(), VIABEDROCK_DISCONNECT_HANDLER_NAME, this.createViaBedrockDisconnectHandler());
|
||||
ctx.pipeline().addBefore(this.lengthCodecName(), VIABEDROCK_FRAME_ENCAPSULATION_HANDLER_NAME, this.createViaBedrockFrameEncapsulationHandler());
|
||||
this.replaceLengthCodec(ctx, this.createViaBedrockBatchLengthCodec());
|
||||
ctx.pipeline().addBefore(VIA_CODEC_NAME, VIABEDROCK_PACKET_ENCAPSULATION_HANDLER_NAME, this.createViaBedrockPacketEncapsulationHandler());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user