Skip to content

Commit

Permalink
Add constructor without version argument to VL pipeline classes (#44)
Browse files Browse the repository at this point in the history
* Add constructor without version argument to VL pipeline classes

Never needed since we could have called the version provider which should be used to get both client and server version.

* Remove check
  • Loading branch information
FlorianMichael authored Jul 28, 2024
1 parent 4961bcf commit a13a5de
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ repositories {
}

dependencies {
compileOnly "com.viaversion:viaversion-common:5.0.2-SNAPSHOT"
compileOnly "com.viaversion:viabackwards-common:5.0.1"
compileOnly "com.viaversion:viaversion-common:5.0.2"
compileOnly "com.viaversion:viabackwards-common:5.0.2"
compileOnly "com.viaversion:viarewind-common:4.0.0"
compileOnly "net.raphimc:ViaLegacy:3.0.1"
compileOnly "net.raphimc:viaaprilfools-common:3.0.1-SNAPSHOT"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
*/
package net.raphimc.vialoader.netty;

import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.api.protocol.version.VersionProvider;
import com.viaversion.viaversion.api.protocol.version.VersionType;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
Expand Down Expand Up @@ -47,6 +49,11 @@ public abstract class VLLegacyPipeline extends ChannelInboundHandlerAdapter {
protected final UserConnection user;
protected final ProtocolVersion version;

public VLLegacyPipeline(final UserConnection user) {
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;
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/net/raphimc/vialoader/netty/VLPipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
*/
package net.raphimc.vialoader.netty;

import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.api.protocol.version.VersionProvider;
import com.viaversion.viaversion.api.protocol.version.VersionType;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
Expand All @@ -45,6 +47,11 @@ public abstract class VLPipeline extends ChannelInboundHandlerAdapter {
protected final UserConnection user;
protected final ProtocolVersion version;

public VLPipeline(final UserConnection user) {
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;
Expand Down

0 comments on commit a13a5de

Please sign in to comment.