Fixed potential issues when using ViaLoader serverside

This commit is contained in:
RaphiMC 2024-10-15 12:44:33 +02:00
parent 83462d813d
commit b0de353c82
No known key found for this signature in database
GPG Key ID: 0F6BB0657A03AC94
4 changed files with 24 additions and 22 deletions

View File

@ -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"

View File

@ -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"

View File

@ -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,6 +61,7 @@ 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());
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());
@ -74,6 +74,7 @@ public abstract class VLLegacyPipeline extends ChannelInboundHandlerAdapter {
ctx.pipeline().addBefore(VIA_DECODER_NAME, VIABEDROCK_PACKET_ENCAPSULATION_HANDLER_NAME, this.createViaBedrockPacketEncapsulationHandler());
}
}
}
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {

View File

@ -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,6 +58,7 @@ public abstract class VLPipeline extends ChannelInboundHandlerAdapter {
public void handlerAdded(ChannelHandlerContext ctx) {
ctx.pipeline().addBefore(this.packetCodecName(), VIA_CODEC_NAME, this.createViaCodec());
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());
@ -69,6 +69,7 @@ public abstract class VLPipeline extends ChannelInboundHandlerAdapter {
ctx.pipeline().addBefore(VIA_CODEC_NAME, VIABEDROCK_PACKET_ENCAPSULATION_HANDLER_NAME, this.createViaBedrockPacketEncapsulationHandler());
}
}
}
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {