diff --git a/build.gradle b/build.gradle index df494d0..7257d53 100644 --- a/build.gradle +++ b/build.gradle @@ -38,8 +38,8 @@ repositories { } dependencies { - compileOnly "com.viaversion:viaversion-common:4.10.0-24w06a-SNAPSHOT" - compileOnly "com.viaversion:viabackwards-common:4.10.0-24w06a-SNAPSHOT" + compileOnly "com.viaversion:viaversion-common:4.10.0-24w07a-SNAPSHOT" + compileOnly "com.viaversion:viabackwards-common:4.10.0-24w07a-SNAPSHOT" compileOnly "com.viaversion:viarewind-common:3.0.5" compileOnly "net.raphimc:ViaLegacy:2.2.21" compileOnly "net.raphimc:ViaAprilFools:2.0.10" diff --git a/src/main/java/net/raphimc/vialoader/impl/platform/ViaVersionPlatformImpl.java b/src/main/java/net/raphimc/vialoader/impl/platform/ViaVersionPlatformImpl.java index a4e5194..2a0e0c7 100644 --- a/src/main/java/net/raphimc/vialoader/impl/platform/ViaVersionPlatformImpl.java +++ b/src/main/java/net/raphimc/vialoader/impl/platform/ViaVersionPlatformImpl.java @@ -21,6 +21,7 @@ import com.viaversion.viaversion.api.ViaAPI; import com.viaversion.viaversion.api.command.ViaCommandSender; import com.viaversion.viaversion.api.configuration.ViaVersionConfig; +import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.platform.ViaPlatform; import com.viaversion.viaversion.configuration.AbstractViaConfig; import com.viaversion.viaversion.libs.gson.JsonObject; @@ -38,13 +39,13 @@ import java.util.concurrent.TimeUnit; import java.util.logging.Logger; -public class ViaVersionPlatformImpl implements ViaPlatform { +public class ViaVersionPlatformImpl implements ViaPlatform { private static final Logger LOGGER = new JLoggerToSLF4J(LoggerFactory.getLogger("ViaVersion")); private final File dataFolder; private final AbstractViaConfig config; - private final ViaAPI api; + private final ViaAPI api; public ViaVersionPlatformImpl(final File rootFolder) { this.dataFolder = new File(rootFolder, "ViaLoader"); @@ -132,7 +133,7 @@ public boolean isProxy() { } @Override - public ViaAPI getApi() { + public ViaAPI getApi() { return this.api; } @@ -159,7 +160,7 @@ protected AbstractViaConfig createConfig() { return new VLViaConfig(new File(this.dataFolder, "viaversion.yml")); } - protected ViaAPI createApi() { + protected ViaAPI createApi() { return new VLApiBase(); } diff --git a/src/main/java/net/raphimc/vialoader/impl/viaversion/VLApiBase.java b/src/main/java/net/raphimc/vialoader/impl/viaversion/VLApiBase.java index 6789395..1644d26 100644 --- a/src/main/java/net/raphimc/vialoader/impl/viaversion/VLApiBase.java +++ b/src/main/java/net/raphimc/vialoader/impl/viaversion/VLApiBase.java @@ -18,9 +18,20 @@ package net.raphimc.vialoader.impl.viaversion; import com.viaversion.viaversion.ViaAPIBase; +import com.viaversion.viaversion.api.connection.UserConnection; +import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; +import io.netty.buffer.ByteBuf; -import java.util.UUID; +public class VLApiBase extends ViaAPIBase { -public class VLApiBase extends ViaAPIBase { + @Override + public ProtocolVersion getPlayerProtocolVersion(final UserConnection player) { + return player.getProtocolInfo().protocolVersion(); + } + + @Override + public void sendRawPacket(final UserConnection player, final ByteBuf packet) { + player.scheduleSendRawPacket(packet); + } }