diff --git a/build.gradle b/build.gradle index 0240069fc..1edc1c2b9 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ allprojects { junitVersion = '5.7.0' slf4jVersion = '1.7.30' log4jVersion = '2.17.1' - nettyVersion = '4.1.74.Final' + nettyVersion = '5.0.0.Alpha1' guavaVersion = '25.1-jre' checkerFrameworkVersion = '3.6.1' configurateVersion = '3.7.2' diff --git a/native/build.gradle b/native/build.gradle index b58547459..02c4cd7d4 100644 --- a/native/build.gradle +++ b/native/build.gradle @@ -19,7 +19,7 @@ license { dependencies { implementation "com.google.guava:guava:${guavaVersion}" - implementation "io.netty:netty-handler:${nettyVersion}" + implementation "io.netty:netty5-handler:${nettyVersion}" implementation "org.checkerframework:checker-qual:${checkerFrameworkVersion}" testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}" diff --git a/native/src/main/java/com/velocitypowered/natives/compression/CompressorUtils.java b/native/src/main/java/com/velocitypowered/natives/compression/CompressorUtils.java index fdde8d320..2936bde10 100644 --- a/native/src/main/java/com/velocitypowered/natives/compression/CompressorUtils.java +++ b/native/src/main/java/com/velocitypowered/natives/compression/CompressorUtils.java @@ -17,7 +17,7 @@ package com.velocitypowered.natives.compression; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import java.util.zip.DataFormatException; class CompressorUtils { diff --git a/native/src/main/java/com/velocitypowered/natives/compression/JavaVelocityCompressor.java b/native/src/main/java/com/velocitypowered/natives/compression/JavaVelocityCompressor.java index e9809f2ac..15bb076f0 100644 --- a/native/src/main/java/com/velocitypowered/natives/compression/JavaVelocityCompressor.java +++ b/native/src/main/java/com/velocitypowered/natives/compression/JavaVelocityCompressor.java @@ -23,7 +23,7 @@ import static com.velocitypowered.natives.compression.CompressorUtils.ZLIB_BUFFE import static com.velocitypowered.natives.compression.CompressorUtils.ensureMaxSize; import com.velocitypowered.natives.util.BufferPreference; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import java.nio.ByteBuffer; import java.util.zip.DataFormatException; import java.util.zip.Deflater; diff --git a/native/src/main/java/com/velocitypowered/natives/compression/LibdeflateVelocityCompressor.java b/native/src/main/java/com/velocitypowered/natives/compression/LibdeflateVelocityCompressor.java index aedb221c0..dde67aefc 100644 --- a/native/src/main/java/com/velocitypowered/natives/compression/LibdeflateVelocityCompressor.java +++ b/native/src/main/java/com/velocitypowered/natives/compression/LibdeflateVelocityCompressor.java @@ -19,7 +19,7 @@ package com.velocitypowered.natives.compression; import com.google.common.base.Preconditions; import com.velocitypowered.natives.util.BufferPreference; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import java.util.zip.DataFormatException; public class LibdeflateVelocityCompressor implements VelocityCompressor { diff --git a/native/src/main/java/com/velocitypowered/natives/compression/VelocityCompressor.java b/native/src/main/java/com/velocitypowered/natives/compression/VelocityCompressor.java index 602eb884c..2a63bc510 100644 --- a/native/src/main/java/com/velocitypowered/natives/compression/VelocityCompressor.java +++ b/native/src/main/java/com/velocitypowered/natives/compression/VelocityCompressor.java @@ -19,7 +19,7 @@ package com.velocitypowered.natives.compression; import com.velocitypowered.natives.Disposable; import com.velocitypowered.natives.Native; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import java.util.zip.DataFormatException; /** diff --git a/native/src/main/java/com/velocitypowered/natives/encryption/JavaVelocityCipher.java b/native/src/main/java/com/velocitypowered/natives/encryption/JavaVelocityCipher.java index 220f39d8a..6abe8666e 100644 --- a/native/src/main/java/com/velocitypowered/natives/encryption/JavaVelocityCipher.java +++ b/native/src/main/java/com/velocitypowered/natives/encryption/JavaVelocityCipher.java @@ -19,7 +19,7 @@ package com.velocitypowered.natives.encryption; import com.google.common.base.Preconditions; import com.velocitypowered.natives.util.BufferPreference; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import java.security.GeneralSecurityException; import javax.crypto.Cipher; import javax.crypto.SecretKey; diff --git a/native/src/main/java/com/velocitypowered/natives/encryption/NativeVelocityCipher.java b/native/src/main/java/com/velocitypowered/natives/encryption/NativeVelocityCipher.java index 26319e398..a29ec4fdf 100644 --- a/native/src/main/java/com/velocitypowered/natives/encryption/NativeVelocityCipher.java +++ b/native/src/main/java/com/velocitypowered/natives/encryption/NativeVelocityCipher.java @@ -19,7 +19,7 @@ package com.velocitypowered.natives.encryption; import com.google.common.base.Preconditions; import com.velocitypowered.natives.util.BufferPreference; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import java.security.GeneralSecurityException; import javax.crypto.SecretKey; diff --git a/native/src/main/java/com/velocitypowered/natives/encryption/VelocityCipher.java b/native/src/main/java/com/velocitypowered/natives/encryption/VelocityCipher.java index c62a70b2b..aacc7e979 100644 --- a/native/src/main/java/com/velocitypowered/natives/encryption/VelocityCipher.java +++ b/native/src/main/java/com/velocitypowered/natives/encryption/VelocityCipher.java @@ -19,7 +19,7 @@ package com.velocitypowered.natives.encryption; import com.velocitypowered.natives.Disposable; import com.velocitypowered.natives.Native; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; public interface VelocityCipher extends Disposable, Native { void process(ByteBuf source); diff --git a/native/src/main/java/com/velocitypowered/natives/util/MoreByteBufUtils.java b/native/src/main/java/com/velocitypowered/natives/util/MoreByteBufUtils.java index 20450221f..2a8340ab0 100644 --- a/native/src/main/java/com/velocitypowered/natives/util/MoreByteBufUtils.java +++ b/native/src/main/java/com/velocitypowered/natives/util/MoreByteBufUtils.java @@ -18,8 +18,8 @@ package com.velocitypowered.natives.util; import com.velocitypowered.natives.Native; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; +import io.netty5.buffer.ByteBuf; +import io.netty5.buffer.ByteBufAllocator; public class MoreByteBufUtils { private MoreByteBufUtils() { diff --git a/native/src/main/java/com/velocitypowered/natives/util/NativeConstraints.java b/native/src/main/java/com/velocitypowered/natives/util/NativeConstraints.java index e42bcfb91..0017b8bd5 100644 --- a/native/src/main/java/com/velocitypowered/natives/util/NativeConstraints.java +++ b/native/src/main/java/com/velocitypowered/natives/util/NativeConstraints.java @@ -17,8 +17,8 @@ package com.velocitypowered.natives.util; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; +import io.netty5.buffer.ByteBuf; +import io.netty5.buffer.Unpooled; import java.util.function.BooleanSupplier; public class NativeConstraints { diff --git a/native/src/test/java/com/velocitypowered/natives/compression/VelocityCompressorTest.java b/native/src/test/java/com/velocitypowered/natives/compression/VelocityCompressorTest.java index c07d96688..15332f68a 100644 --- a/native/src/test/java/com/velocitypowered/natives/compression/VelocityCompressorTest.java +++ b/native/src/test/java/com/velocitypowered/natives/compression/VelocityCompressorTest.java @@ -24,9 +24,9 @@ import static org.junit.jupiter.api.condition.OS.LINUX; import com.velocitypowered.natives.util.BufferPreference; import com.velocitypowered.natives.util.Natives; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; -import io.netty.buffer.Unpooled; +import io.netty5.buffer.ByteBuf; +import io.netty5.buffer.ByteBufUtil; +import io.netty5.buffer.Unpooled; import java.io.IOException; import java.util.Random; import java.util.function.Supplier; diff --git a/native/src/test/java/com/velocitypowered/natives/encryption/VelocityCipherTest.java b/native/src/test/java/com/velocitypowered/natives/encryption/VelocityCipherTest.java index 6143d8d10..328bc35c7 100644 --- a/native/src/test/java/com/velocitypowered/natives/encryption/VelocityCipherTest.java +++ b/native/src/test/java/com/velocitypowered/natives/encryption/VelocityCipherTest.java @@ -22,9 +22,9 @@ import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.condition.OS.LINUX; import com.velocitypowered.natives.util.Natives; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; -import io.netty.buffer.Unpooled; +import io.netty5.buffer.ByteBuf; +import io.netty5.buffer.ByteBufUtil; +import io.netty5.buffer.Unpooled; import java.security.GeneralSecurityException; import java.util.Random; import java.util.function.Supplier; diff --git a/proxy/build.gradle b/proxy/build.gradle index e8b070bfb..78d39a923 100644 --- a/proxy/build.gradle +++ b/proxy/build.gradle @@ -45,13 +45,13 @@ dependencies { implementation project(':velocity-api').sourceSets.ap.output implementation project(':velocity-native') - implementation "io.netty:netty-codec:${nettyVersion}" - implementation "io.netty:netty-codec-haproxy:${nettyVersion}" - implementation "io.netty:netty-codec-http:${nettyVersion}" - implementation "io.netty:netty-handler:${nettyVersion}" - implementation "io.netty:netty-transport-native-epoll:${nettyVersion}" - implementation "io.netty:netty-transport-native-epoll:${nettyVersion}:linux-x86_64" - implementation "io.netty:netty-transport-native-epoll:${nettyVersion}:linux-aarch_64" + implementation "io.netty:netty5-codec:${nettyVersion}" +// implementation "io.netty.contrib:netty5-codec-haproxy:5.0.0.Final-SNAPSHOT" + implementation "io.netty:netty5-codec-http:${nettyVersion}" + implementation "io.netty:netty5-handler:${nettyVersion}" + implementation "io.netty:netty5-transport-native-epoll:${nettyVersion}" + implementation "io.netty:netty5-transport-native-epoll:${nettyVersion}:linux-x86_64" + implementation "io.netty:netty5-transport-native-epoll:${nettyVersion}:linux-aarch_64" implementation "org.apache.logging.log4j:log4j-api:${log4jVersion}" implementation "org.apache.logging.log4j:log4j-core:${log4jVersion}" diff --git a/proxy/src/main/java/com/velocitypowered/proxy/Velocity.java b/proxy/src/main/java/com/velocitypowered/proxy/Velocity.java index 25b3a7c47..d768a2e3d 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/Velocity.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/Velocity.java @@ -17,8 +17,8 @@ package com.velocitypowered.proxy; -import io.netty.util.ResourceLeakDetector; -import io.netty.util.ResourceLeakDetector.Level; +import io.netty5.util.ResourceLeakDetector; +import io.netty5.util.ResourceLeakDetector.Level; import java.text.DecimalFormat; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -38,12 +38,12 @@ public class Velocity { // If Velocity's natives are being extracted to a different temporary directory, make sure the // Netty natives are extracted there as well if (System.getProperty("velocity.natives-tmpdir") != null) { - System.setProperty("io.netty.native.workdir", System.getProperty("velocity.natives-tmpdir")); + System.setProperty("io.netty5.native.workdir", System.getProperty("velocity.natives-tmpdir")); } // Disable the resource leak detector by default as it reduces performance. Allow the user to // override this if desired. - if (System.getProperty("io.netty.leakDetection.level") == null) { + if (System.getProperty("io.netty5.leakDetection.level") == null) { ResourceLeakDetector.setLevel(Level.DISABLED); } } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java b/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java index 65158e915..e9be95c86 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java @@ -62,10 +62,10 @@ import com.velocitypowered.proxy.util.bossbar.AdventureBossBarManager; import com.velocitypowered.proxy.util.ratelimit.Ratelimiter; import com.velocitypowered.proxy.util.ratelimit.Ratelimiters; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.Channel; -import io.netty.channel.ChannelInitializer; -import io.netty.channel.EventLoopGroup; +import io.netty5.bootstrap.Bootstrap; +import io.netty5.channel.Channel; +import io.netty5.channel.ChannelInitializer; +import io.netty5.channel.EventLoopGroup; import java.io.IOException; import java.net.InetSocketAddress; import java.net.http.HttpClient; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java index 773f6d359..a57201501 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java @@ -36,7 +36,6 @@ import com.velocitypowered.proxy.VelocityServer; import com.velocitypowered.proxy.connection.client.HandshakeSessionHandler; import com.velocitypowered.proxy.connection.client.LoginSessionHandler; import com.velocitypowered.proxy.connection.client.StatusSessionHandler; -import com.velocitypowered.proxy.network.Connections; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.protocol.VelocityConnectionEvent; @@ -48,17 +47,15 @@ import com.velocitypowered.proxy.protocol.netty.MinecraftDecoder; import com.velocitypowered.proxy.protocol.netty.MinecraftEncoder; import com.velocitypowered.proxy.protocol.netty.MinecraftVarintLengthEncoder; import com.velocitypowered.proxy.util.except.QuietDecoderException; -import io.netty.buffer.ByteBuf; -import io.netty.channel.Channel; -import io.netty.channel.ChannelFutureListener; -import io.netty.channel.ChannelHandler; -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.ChannelInboundHandlerAdapter; -import io.netty.channel.EventLoop; -import io.netty.handler.codec.haproxy.HAProxyMessage; -import io.netty.handler.timeout.ReadTimeoutException; -import io.netty.util.ReferenceCountUtil; -import java.net.InetSocketAddress; +import io.netty5.buffer.ByteBuf; +import io.netty5.channel.Channel; +import io.netty5.channel.ChannelFutureListeners; +import io.netty5.channel.ChannelHandler; +import io.netty5.channel.ChannelHandlerAdapter; +import io.netty5.channel.ChannelHandlerContext; +import io.netty5.channel.EventLoop; +import io.netty5.handler.timeout.ReadTimeoutException; +import io.netty5.util.ReferenceCountUtil; import java.net.SocketAddress; import java.security.GeneralSecurityException; import java.util.concurrent.TimeUnit; @@ -72,7 +69,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * A utility class to make working with the pipeline a little less painful and transparently handles * certain Minecraft protocol mechanics. */ -public class MinecraftConnection extends ChannelInboundHandlerAdapter { +public class MinecraftConnection extends ChannelHandlerAdapter { private static final Logger logger = LogManager.getLogger(MinecraftConnection.class); @@ -142,10 +139,7 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { if (!pkt.handle(sessionHandler)) { sessionHandler.handleGeneric((MinecraftPacket) msg); } - } else if (msg instanceof HAProxyMessage) { - HAProxyMessage proxyMessage = (HAProxyMessage) msg; - this.remoteAddress = new InetSocketAddress(proxyMessage.sourceAddress(), - proxyMessage.sourcePort()); + // TODO: Readd HAProxy support } else if (msg instanceof ByteBuf) { sessionHandler.handleUnknown((ByteBuf) msg); } @@ -201,12 +195,13 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { } } - private void ensureInEventLoop() { - Preconditions.checkState(this.channel.eventLoop().inEventLoop(), "Not in event loop"); + private void ensureInExecutor() { + Preconditions.checkState(this.channel.executor().inEventLoop(), + "Not running in channel executor"); } - public EventLoop eventLoop() { - return channel.eventLoop(); + public EventLoop executor() { + return channel.executor(); } /** @@ -215,7 +210,7 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { */ public void write(Object msg) { if (channel.isActive()) { - channel.writeAndFlush(msg, channel.voidPromise()); + channel.writeAndFlush(msg); } else { ReferenceCountUtil.release(msg); } @@ -227,7 +222,7 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { */ public void delayedWrite(Object msg) { if (channel.isActive()) { - channel.write(msg, channel.voidPromise()); + channel.write(msg); } else { ReferenceCountUtil.release(msg); } @@ -251,18 +246,18 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { boolean is17 = this.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_8) < 0 && this.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_7_2) >= 0; if (is17 && this.getState() != StateRegistry.STATUS) { - channel.eventLoop().execute(() -> { + channel.executor().execute(() -> { // 1.7.x versions have a race condition with switching protocol states, so just explicitly // close the connection after a short while. this.setAutoReading(false); - channel.eventLoop().schedule(() -> { + channel.executor().schedule(() -> { knownDisconnect = true; - channel.writeAndFlush(msg).addListener(ChannelFutureListener.CLOSE); + channel.writeAndFlush(msg).addListener(channel, ChannelFutureListeners.CLOSE); }, 250, TimeUnit.MILLISECONDS); }); } else { knownDisconnect = true; - channel.writeAndFlush(msg).addListener(ChannelFutureListener.CLOSE); + channel.writeAndFlush(msg).addListener(channel, ChannelFutureListeners.CLOSE); } } } @@ -277,13 +272,13 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { */ public void close(boolean markKnown) { if (channel.isActive()) { - if (channel.eventLoop().inEventLoop()) { + if (channel.executor().inEventLoop()) { if (markKnown) { knownDisconnect = true; } channel.close(); } else { - channel.eventLoop().execute(() -> { + channel.executor().execute(() -> { if (markKnown) { knownDisconnect = true; } @@ -322,7 +317,7 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { * @param autoReading whether or not we should read data automatically */ public void setAutoReading(boolean autoReading) { - ensureInEventLoop(); + ensureInExecutor(); channel.config().setAutoRead(autoReading); if (autoReading) { @@ -340,7 +335,7 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { * @param state the new state */ public void setState(StateRegistry state) { - ensureInEventLoop(); + ensureInExecutor(); this.state = state; this.channel.pipeline().get(MinecraftEncoder.class).setState(state); @@ -356,7 +351,7 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { * @param protocolVersion the protocol version to use */ public void setProtocolVersion(ProtocolVersion protocolVersion) { - ensureInEventLoop(); + ensureInExecutor(); boolean changed = this.protocolVersion != protocolVersion; this.protocolVersion = protocolVersion; @@ -383,7 +378,7 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { * @param sessionHandler the handler to use */ public void setSessionHandler(MinecraftSessionHandler sessionHandler) { - ensureInEventLoop(); + ensureInExecutor(); if (this.sessionHandler != null) { this.sessionHandler.deactivated(); @@ -403,7 +398,7 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { */ public void setCompressionThreshold(int threshold) { ensureOpen(); - ensureInEventLoop(); + ensureInExecutor(); if (threshold == -1) { final ChannelHandler removedDecoder = channel.pipeline().remove(COMPRESSION_DECODER); @@ -445,7 +440,7 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { */ public void enableEncryption(byte[] secret) throws GeneralSecurityException { ensureOpen(); - ensureInEventLoop(); + ensureInExecutor(); SecretKey key = new SecretKeySpec(secret, "AES"); @@ -465,7 +460,7 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { } public void setAssociation(MinecraftConnectionAssociation association) { - ensureInEventLoop(); + ensureInExecutor(); this.association = association; } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftSessionHandler.java index e72f42d64..6d03d5e96 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftSessionHandler.java @@ -52,7 +52,7 @@ import com.velocitypowered.proxy.protocol.packet.title.TitleClearPacket; import com.velocitypowered.proxy.protocol.packet.title.TitleSubtitlePacket; import com.velocitypowered.proxy.protocol.packet.title.TitleTextPacket; import com.velocitypowered.proxy.protocol.packet.title.TitleTimesPacket; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; public interface MinecraftSessionHandler { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/BackendPlaySessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/BackendPlaySessionHandler.java index c485be158..890d00cc2 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/BackendPlaySessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/BackendPlaySessionHandler.java @@ -48,11 +48,11 @@ import com.velocitypowered.proxy.protocol.packet.ResourcePackRequest; import com.velocitypowered.proxy.protocol.packet.ResourcePackResponse; import com.velocitypowered.proxy.protocol.packet.TabCompleteResponse; import com.velocitypowered.proxy.protocol.util.PluginMessageUtil; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; -import io.netty.buffer.Unpooled; -import io.netty.channel.Channel; -import io.netty.handler.timeout.ReadTimeoutException; +import io.netty5.buffer.ByteBuf; +import io.netty5.buffer.ByteBufUtil; +import io.netty5.buffer.Unpooled; +import io.netty5.channel.Channel; +import io.netty5.handler.timeout.ReadTimeoutException; import java.util.regex.Pattern; import org.apache.logging.log4j.LogManager; @@ -172,7 +172,7 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler { PlayerResourcePackStatusEvent.Status.DECLINED )); } - }, playerConnection.eventLoop()).exceptionally((ex) -> { + }, playerConnection.executor()).exceptionally((ex) -> { if (serverConn.getConnection() != null) { serverConn.getConnection().write(new ResourcePackResponse( packet.getHash(), @@ -229,7 +229,7 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler { Unpooled.wrappedBuffer(copy)); playerConnection.write(copied); } - }, playerConnection.eventLoop()) + }, playerConnection.executor()) .exceptionally((ex) -> { logger.error("Exception while handling plugin message {}", packet, ex); return null; @@ -260,7 +260,7 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler { server.getEventManager().fire( new PlayerAvailableCommandsEvent(serverConn.getPlayer(), rootNode)) - .thenAcceptAsync(event -> playerConnection.write(commands), playerConnection.eventLoop()) + .thenAcceptAsync(event -> playerConnection.write(commands), playerConnection.executor()) .exceptionally((ex) -> { logger.error("Exception while handling available commands for {}", playerConnection, ex); return null; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/BungeeCordMessageResponder.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/BungeeCordMessageResponder.java index 74a04fa1a..f81b497c0 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/BungeeCordMessageResponder.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/BungeeCordMessageResponder.java @@ -34,8 +34,8 @@ import com.velocitypowered.proxy.protocol.util.ByteBufDataOutput; import com.velocitypowered.proxy.server.VelocityRegisteredServer; import edu.umd.cs.findbugs.annotations.Nullable; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; +import io.netty5.buffer.ByteBuf; +import io.netty5.buffer.Unpooled; import java.util.Optional; import java.util.StringJoiner; import net.kyori.adventure.identity.Identity; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/LoginSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/LoginSessionHandler.java index 5ed599c21..0ccbaeb73 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/LoginSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/LoginSessionHandler.java @@ -37,9 +37,9 @@ import com.velocitypowered.proxy.protocol.packet.LoginPluginResponse; import com.velocitypowered.proxy.protocol.packet.ServerLoginSuccess; import com.velocitypowered.proxy.protocol.packet.SetCompression; import com.velocitypowered.proxy.util.except.QuietRuntimeException; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; -import io.netty.buffer.Unpooled; +import io.netty5.buffer.ByteBuf; +import io.netty5.buffer.ByteBufUtil; +import io.netty5.buffer.Unpooled; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.util.concurrent.CompletableFuture; @@ -101,7 +101,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler { } else { mc.write(new LoginPluginResponse(packet.getId(), false, Unpooled.EMPTY_BUFFER)); } - }, mc.eventLoop()); + }, mc.executor()); } return true; } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/TransitionSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/TransitionSessionHandler.java index 3cb811ba5..e6c91312d 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/TransitionSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/TransitionSessionHandler.java @@ -138,7 +138,7 @@ public class TransitionSessionHandler implements MinecraftSessionHandler { server.getEventManager().fireAndForget(new ServerPostConnectEvent(player, existingConnection == null ? null : existingConnection.getServer())); resultFuture.complete(ConnectionRequestResults.successful(serverConn.getServer())); - }, smc.eventLoop()) + }, smc.executor()) .exceptionally(exc -> { logger.error("Unable to switch to new server {} for {}", serverConn.getServerInfo().getName(), diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java index 9fca54963..252d3c924 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java @@ -41,10 +41,9 @@ import com.velocitypowered.proxy.protocol.packet.Handshake; import com.velocitypowered.proxy.protocol.packet.PluginMessage; import com.velocitypowered.proxy.protocol.packet.ServerLogin; import com.velocitypowered.proxy.server.VelocityRegisteredServer; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.channel.ChannelFutureListener; -import java.net.InetSocketAddress; +import io.netty5.buffer.ByteBuf; +import io.netty5.buffer.Unpooled; +import io.netty5.channel.Channel; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.List; @@ -88,14 +87,16 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation, CompletableFuture result = new CompletableFuture<>(); // Note: we use the event loop for the connection the player is on. This reduces context // switches. - server.createBootstrap(proxyPlayer.getConnection().eventLoop()) + server.createBootstrap(proxyPlayer.getConnection().executor()) .handler(server.getBackendChannelInitializer()) .connect(registeredServer.getServerInfo().getAddress()) - .addListener((ChannelFutureListener) future -> { + .addListener(future -> { if (future.isSuccess()) { - connection = new MinecraftConnection(future.channel(), server); + final Channel channel = future.getNow(); + + connection = new MinecraftConnection(channel, server); connection.setAssociation(VelocityServerConnection.this); - future.channel().pipeline().addLast(HANDLER, connection); + channel.pipeline().addLast(HANDLER, connection); // Kick off the connection process connection.setSessionHandler( diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java index 1a107e350..3abb3a2e1 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java @@ -58,10 +58,10 @@ import com.velocitypowered.proxy.protocol.packet.TabCompleteResponse.Offer; import com.velocitypowered.proxy.protocol.packet.title.GenericTitlePacket; import com.velocitypowered.proxy.protocol.util.PluginMessageUtil; import com.velocitypowered.proxy.util.CharacterUtil; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; -import io.netty.buffer.Unpooled; -import io.netty.util.ReferenceCountUtil; +import io.netty5.buffer.ByteBuf; +import io.netty5.buffer.ByteBufUtil; +import io.netty5.buffer.Unpooled; +import io.netty5.util.ReferenceCountUtil; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -189,7 +189,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { smc.write(packet); } } - }, smc.eventLoop()) + }, smc.executor()) .exceptionally((ex) -> { logger.error("Exception while handling player chat for {}", player, ex); return null; @@ -283,7 +283,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { backendConn.write(message); } } - }, backendConn.eventLoop()) + }, backendConn.executor()) .exceptionally((ex) -> { logger.error("Exception while handling plugin message packet for {}", player, ex); @@ -353,7 +353,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { // sure to do it on a future invocation of the event loop, otherwise while the issue will // fix itself, we'll still disable auto-reading and instead of backpressure resolution, we // get client timeouts. - player.getConnection().eventLoop().execute(() -> player.getConnection().flush()); + player.getConnection().executor().execute(() -> player.getConnection().flush()); } VelocityServerConnection serverConn = player.getConnectedServer(); @@ -526,7 +526,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { resp.getOffers().addAll(offers); player.getConnection().write(resp); } - }, player.getConnection().eventLoop()) + }, player.getConnection().executor()) .exceptionally((ex) -> { logger.error("Exception while handling command tab completion for player {} executing {}", player, command, ex); @@ -589,7 +589,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { player.getUsername(), command, e); } - }, player.getConnection().eventLoop()) + }, player.getConnection().executor()) .exceptionally((ex) -> { logger.error( "Exception while finishing command tab completion, with request {} and response {}", @@ -610,7 +610,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { response.getOffers().add(new Offer(s)); } player.getConnection().write(response); - }, player.getConnection().eventLoop()) + }, player.getConnection().executor()) .exceptionally((ex) -> { logger.error( "Exception while finishing regular tab completion, with request {} and response{}", @@ -629,14 +629,14 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { String commandToRun = result.getCommand().orElse(originalCommand); if (result.isForwardToServer()) { return CompletableFuture.runAsync(() -> smc.write(Chat.createServerbound("/" - + commandToRun)), smc.eventLoop()); + + commandToRun)), smc.executor()); } else { return server.getCommandManager().executeImmediatelyAsync(player, commandToRun) .thenAcceptAsync(hasRun -> { if (!hasRun) { smc.write(Chat.createServerbound("/" + commandToRun)); } - }, smc.eventLoop()); + }, smc.executor()); } } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java index 0851f1139..a2b91619a 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java @@ -70,8 +70,8 @@ import com.velocitypowered.proxy.tablist.VelocityTabListLegacy; import com.velocitypowered.proxy.util.ClosestLocaleMatcher; import com.velocitypowered.proxy.util.DurationUtils; import com.velocitypowered.proxy.util.collect.CappedSet; -import io.netty.buffer.ByteBufUtil; -import io.netty.buffer.Unpooled; +import io.netty5.buffer.ByteBufUtil; +import io.netty5.buffer.Unpooled; import java.net.InetSocketAddress; import java.util.ArrayDeque; import java.util.Collection; @@ -90,11 +90,10 @@ import net.kyori.adventure.identity.Identity; import net.kyori.adventure.permission.PermissionChecker; import net.kyori.adventure.pointer.Pointers; import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.TranslatableComponent; import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; -import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer; +import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; import net.kyori.adventure.title.Title.Times; import net.kyori.adventure.title.TitlePart; import net.kyori.adventure.translation.GlobalTranslator; @@ -108,8 +107,8 @@ import org.jetbrains.annotations.NotNull; public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { private static final int MAX_PLUGIN_CHANNELS = 1024; - private static final PlainComponentSerializer PASS_THRU_TRANSLATE = new PlainComponentSerializer( - c -> "", TranslatableComponent::key); + private static final PlainTextComponentSerializer PASS_THRU_TRANSLATE = + PlainTextComponentSerializer.plainText(); static final PermissionProvider DEFAULT_PERMISSIONS = s -> PermissionFunction.ALWAYS_UNDEFINED; private static final Logger logger = LogManager.getLogger(ConnectedPlayer.class); @@ -491,10 +490,10 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { @Override public void disconnect(Component reason) { - if (connection.eventLoop().inEventLoop()) { + if (connection.executor().inEventLoop()) { disconnect0(reason, false); } else { - connection.eventLoop().execute(() -> disconnect0(reason, false)); + connection.executor().execute(() -> disconnect0(reason, false)); } } @@ -689,7 +688,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { // The only remaining value is successful (no need to do anything!) break; } - }, connection.eventLoop()); + }, connection.executor()); } else if (event.getResult() instanceof Notify) { Notify res = (Notify) event.getResult(); if (event.kickedDuringServerConnect() && previouslyConnected) { @@ -701,7 +700,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { // In case someone gets creative, assume we want to disconnect the player. disconnect(friendlyReason); } - }, connection.eventLoop()); + }, connection.executor()); } /** @@ -984,7 +983,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { } if (!peek) { - connection.eventLoop().execute(this::tickResourcePackQueue); + connection.executor().execute(this::tickResourcePackQueue); } return queued != null @@ -1067,7 +1066,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { } private CompletableFuture> getInitialStatus() { - return CompletableFuture.supplyAsync(() -> checkServer(toConnect), connection.eventLoop()); + return CompletableFuture.supplyAsync(() -> checkServer(toConnect), connection.executor()); } private CompletableFuture internalConnect() { @@ -1099,8 +1098,8 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { ConnectedPlayer.this, server); connectionInFlight = con; return con.connect().whenCompleteAsync( - (result, exception) -> this.resetIfInFlightIs(con), connection.eventLoop()); - }, connection.eventLoop()); + (result, exception) -> this.resetIfInFlightIs(con), connection.executor()); + }, connection.executor()); }); } @@ -1123,7 +1122,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { if (throwable != null) { logger.error("Exception during connect; status = {}", status, throwable); } - }, connection.eventLoop()) + }, connection.executor()) .thenApply(x -> x); } @@ -1158,7 +1157,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { // The only remaining value is successful (no need to do anything!) break; } - }, connection.eventLoop()) + }, connection.executor()) .thenApply(Result::isSuccessful); } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/HandshakeSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/HandshakeSessionHandler.java index 74e7ad080..70748e0b2 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/HandshakeSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/HandshakeSessionHandler.java @@ -35,7 +35,7 @@ import com.velocitypowered.proxy.protocol.packet.Handshake; import com.velocitypowered.proxy.protocol.packet.LegacyDisconnect; import com.velocitypowered.proxy.protocol.packet.LegacyHandshake; import com.velocitypowered.proxy.protocol.packet.LegacyPing; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import java.net.InetAddress; import java.net.InetSocketAddress; import java.util.Optional; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginInboundConnection.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginInboundConnection.java index a9efb8d3d..a04c77d1d 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginInboundConnection.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginInboundConnection.java @@ -22,8 +22,8 @@ import com.velocitypowered.api.proxy.LoginPhaseConnection; import com.velocitypowered.api.proxy.messages.ChannelIdentifier; import com.velocitypowered.proxy.protocol.packet.LoginPluginMessage; import com.velocitypowered.proxy.protocol.packet.LoginPluginResponse; -import io.netty.buffer.ByteBufUtil; -import io.netty.buffer.Unpooled; +import io.netty5.buffer.ByteBufUtil; +import io.netty5.buffer.Unpooled; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import java.net.InetSocketAddress; import java.util.ArrayDeque; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java index 5ee775e85..ebaff4b4e 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java @@ -50,14 +50,11 @@ import com.velocitypowered.proxy.protocol.packet.LoginPluginResponse; import com.velocitypowered.proxy.protocol.packet.ServerLogin; import com.velocitypowered.proxy.protocol.packet.ServerLoginSuccess; import com.velocitypowered.proxy.protocol.packet.SetCompression; -import com.velocitypowered.proxy.util.InformationUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import java.net.InetSocketAddress; import java.net.URI; import java.net.http.HttpRequest; -import java.net.http.HttpRequest.BodyPublishers; import java.net.http.HttpResponse.BodyHandlers; -import java.nio.charset.StandardCharsets; import java.security.GeneralSecurityException; import java.security.KeyPair; import java.security.MessageDigest; @@ -176,8 +173,8 @@ public class LoginSessionHandler implements MinecraftSessionHandler { hasJoinedResponse.statusCode(), login.getUsername(), playerIp); inbound.disconnect(Component.translatable("multiplayer.disconnect.authservers_down")); } - }, mcConnection.eventLoop()).exceptionally(err -> { - mcConnection.eventLoop().execute(() -> { + }, mcConnection.executor()).exceptionally(err -> { + mcConnection.executor().execute(() -> { if (!mcConnection.isClosed()) { logger.error("Unable to enable encryption", err); mcConnection.close(true); @@ -219,7 +216,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler { return; } - mcConnection.eventLoop().execute(() -> { + mcConnection.executor().execute(() -> { if (!result.isForceOfflineMode() && (server.getConfiguration().isOnlineMode() || result.isOnlineModeAllowed())) { // Request encryption. @@ -231,7 +228,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler { } }); }); - }, mcConnection.eventLoop()) + }, mcConnection.executor()) .exceptionally((ex) -> { logger.error("Exception in pre-login stage", ex); return null; @@ -292,8 +289,8 @@ public class LoginSessionHandler implements MinecraftSessionHandler { } completeLoginProtocolPhaseAndInitialize(player); } - }, mcConnection.eventLoop()); - }, mcConnection.eventLoop()).exceptionally((ex) -> { + }, mcConnection.executor()); + }, mcConnection.executor()).exceptionally((ex) -> { logger.error("Exception during connection of {}", finalProfile, ex); return null; }); @@ -345,7 +342,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler { return null; }); } - }, mcConnection.eventLoop()) + }, mcConnection.executor()) .exceptionally((ex) -> { logger.error("Exception while completing login initialisation phase for {}", player, ex); return null; @@ -366,7 +363,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler { return; } player.createConnectionRequest(toTry.get()).fireAndForget(); - }, mcConnection.eventLoop()); + }, mcConnection.executor()); } @Override diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/StatusSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/StatusSessionHandler.java index 792c5b458..d97b073e4 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/StatusSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/StatusSessionHandler.java @@ -37,7 +37,7 @@ import com.velocitypowered.proxy.protocol.packet.StatusRequest; import com.velocitypowered.proxy.protocol.packet.StatusResponse; import com.velocitypowered.proxy.server.VelocityRegisteredServer; import com.velocitypowered.proxy.util.except.QuietRuntimeException; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import java.net.InetSocketAddress; import java.util.ArrayList; import java.util.List; @@ -96,7 +96,7 @@ public class StatusSessionHandler implements MinecraftSessionHandler { continue; } VelocityRegisteredServer vrs = (VelocityRegisteredServer) rs.get(); - pings.add(vrs.ping(connection.eventLoop(), pingingVersion)); + pings.add(vrs.ping(connection.executor(), pingingVersion)); } if (pings.isEmpty()) { return CompletableFuture.completedFuture(fallback); @@ -186,7 +186,7 @@ public class StatusSessionHandler implements MinecraftSessionHandler { .thenCompose(ping -> server.getEventManager().fire(new ProxyPingEvent(inbound, ping))) .thenAcceptAsync(event -> connection.closeWith( LegacyDisconnect.fromServerPing(event.getPing(), packet.getVersion())), - connection.eventLoop()) + connection.executor()) .exceptionally((ex) -> { logger.error("Exception while handling legacy ping {}", packet, ex); return null; @@ -216,7 +216,7 @@ public class StatusSessionHandler implements MinecraftSessionHandler { .toJson(event.getPing(), json); connection.write(new StatusResponse(json)); }, - connection.eventLoop()) + connection.executor()) .exceptionally((ex) -> { logger.error("Exception while handling status request {}", packet, ex); return null; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/forge/legacy/LegacyForgeUtil.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/forge/legacy/LegacyForgeUtil.java index f541c789e..863921054 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/forge/legacy/LegacyForgeUtil.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/forge/legacy/LegacyForgeUtil.java @@ -26,8 +26,8 @@ import com.google.common.collect.ImmutableList; import com.velocitypowered.api.util.ModInfo; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.packet.PluginMessage; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; +import io.netty5.buffer.ByteBuf; +import io.netty5.buffer.Unpooled; import java.util.List; class LegacyForgeUtil { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/network/BackendChannelInitializer.java b/proxy/src/main/java/com/velocitypowered/proxy/network/BackendChannelInitializer.java index 0e41fd68a..78e983b7d 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/network/BackendChannelInitializer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/network/BackendChannelInitializer.java @@ -31,9 +31,9 @@ import com.velocitypowered.proxy.protocol.netty.MinecraftDecoder; import com.velocitypowered.proxy.protocol.netty.MinecraftEncoder; import com.velocitypowered.proxy.protocol.netty.MinecraftVarintFrameDecoder; import com.velocitypowered.proxy.protocol.netty.MinecraftVarintLengthEncoder; -import io.netty.channel.Channel; -import io.netty.channel.ChannelInitializer; -import io.netty.handler.timeout.ReadTimeoutHandler; +import io.netty5.channel.Channel; +import io.netty5.channel.ChannelInitializer; +import io.netty5.handler.timeout.ReadTimeoutHandler; import java.util.concurrent.TimeUnit; @SuppressWarnings("WeakerAccess") diff --git a/proxy/src/main/java/com/velocitypowered/proxy/network/BackendChannelInitializerHolder.java b/proxy/src/main/java/com/velocitypowered/proxy/network/BackendChannelInitializerHolder.java index 8d667ffaa..6145cdd7d 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/network/BackendChannelInitializerHolder.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/network/BackendChannelInitializerHolder.java @@ -17,8 +17,8 @@ package com.velocitypowered.proxy.network; -import io.netty.channel.Channel; -import io.netty.channel.ChannelInitializer; +import io.netty5.channel.Channel; +import io.netty5.channel.ChannelInitializer; import java.util.function.Supplier; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/network/ConnectionManager.java b/proxy/src/main/java/com/velocitypowered/proxy/network/ConnectionManager.java index 32f7946bd..396a9052e 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/network/ConnectionManager.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/network/ConnectionManager.java @@ -25,15 +25,13 @@ import com.velocitypowered.natives.util.Natives; import com.velocitypowered.proxy.VelocityServer; import com.velocitypowered.proxy.network.netty.SeparatePoolInetNameResolver; import com.velocitypowered.proxy.protocol.netty.GS4QueryHandler; -import io.netty.bootstrap.Bootstrap; -import io.netty.bootstrap.ServerBootstrap; -import io.netty.channel.Channel; -import io.netty.channel.ChannelFutureListener; -import io.netty.channel.ChannelOption; -import io.netty.channel.EventLoopGroup; -import io.netty.channel.WriteBufferWaterMark; -import io.netty.channel.epoll.EpollChannelOption; -import io.netty.util.concurrent.GlobalEventExecutor; +import io.netty5.bootstrap.Bootstrap; +import io.netty5.bootstrap.ServerBootstrap; +import io.netty5.channel.Channel; +import io.netty5.channel.ChannelOption; +import io.netty5.channel.EventLoopGroup; +import io.netty5.channel.WriteBufferWaterMark; +import io.netty5.util.concurrent.GlobalEventExecutor; import java.net.InetSocketAddress; import java.net.http.HttpClient; import java.util.HashMap; @@ -92,7 +90,7 @@ public final class ConnectionManager { */ public void bind(final InetSocketAddress address) { final ServerBootstrap bootstrap = new ServerBootstrap() - .channelFactory(this.transportType.serverSocketChannelFactory) + .channel(this.transportType.serverSocketChannelClass) .group(this.bossGroup, this.workerGroup) .childOption(ChannelOption.WRITE_BUFFER_WATER_MARK, SERVER_WRITE_MARK) .childHandler(this.serverChannelInitializer.get()) @@ -100,13 +98,13 @@ public final class ConnectionManager { .childOption(ChannelOption.IP_TOS, 0x18) .localAddress(address); - if (transportType == TransportType.EPOLL && server.getConfiguration().useTcpFastOpen()) { - bootstrap.option(EpollChannelOption.TCP_FASTOPEN, 3); + if (server.getConfiguration().useTcpFastOpen()) { + bootstrap.option(ChannelOption.TCP_FASTOPEN, 3); } bootstrap.bind() - .addListener((ChannelFutureListener) future -> { - final Channel channel = future.channel(); + .addListener(future -> { + final Channel channel = future.getNow(); if (future.isSuccess()) { this.endpoints.put(address, new Endpoint(channel, ListenerType.MINECRAFT)); LOGGER.info("Listening on {}", channel.localAddress()); @@ -134,8 +132,8 @@ public final class ConnectionManager { .handler(new GS4QueryHandler(this.server)) .localAddress(address); bootstrap.bind() - .addListener((ChannelFutureListener) future -> { - final Channel channel = future.channel(); + .addListener(future -> { + final Channel channel = future.getNow(); if (future.isSuccess()) { this.endpoints.put(address, new Endpoint(channel, ListenerType.QUERY)); LOGGER.info("Listening for GS4 query on {}", channel.localAddress()); @@ -164,8 +162,8 @@ public final class ConnectionManager { this.server.getConfiguration().getConnectTimeout()) .group(group == null ? this.workerGroup : group) .resolver(this.resolver.asGroup()); - if (transportType == TransportType.EPOLL && server.getConfiguration().useTcpFastOpen()) { - bootstrap.option(EpollChannelOption.TCP_FASTOPEN_CONNECT, true); + if (server.getConfiguration().useTcpFastOpen()) { + bootstrap.option(ChannelOption.TCP_FASTOPEN_CONNECT, true); } return bootstrap; } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/network/Endpoint.java b/proxy/src/main/java/com/velocitypowered/proxy/network/Endpoint.java index af453e636..61d128602 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/network/Endpoint.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/network/Endpoint.java @@ -19,7 +19,7 @@ package com.velocitypowered.proxy.network; import com.google.common.base.Preconditions; import com.velocitypowered.api.network.ListenerType; -import io.netty.channel.Channel; +import io.netty5.channel.Channel; /** * Represents a listener endpoint. diff --git a/proxy/src/main/java/com/velocitypowered/proxy/network/ServerChannelInitializer.java b/proxy/src/main/java/com/velocitypowered/proxy/network/ServerChannelInitializer.java index 55f7d6f88..74934b649 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/network/ServerChannelInitializer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/network/ServerChannelInitializer.java @@ -35,10 +35,9 @@ import com.velocitypowered.proxy.protocol.netty.MinecraftDecoder; import com.velocitypowered.proxy.protocol.netty.MinecraftEncoder; import com.velocitypowered.proxy.protocol.netty.MinecraftVarintFrameDecoder; import com.velocitypowered.proxy.protocol.netty.MinecraftVarintLengthEncoder; -import io.netty.channel.Channel; -import io.netty.channel.ChannelInitializer; -import io.netty.handler.codec.haproxy.HAProxyMessageDecoder; -import io.netty.handler.timeout.ReadTimeoutHandler; +import io.netty5.channel.Channel; +import io.netty5.channel.ChannelInitializer; +import io.netty5.handler.timeout.ReadTimeoutHandler; import java.util.concurrent.TimeUnit; @SuppressWarnings("WeakerAccess") @@ -67,8 +66,6 @@ public class ServerChannelInitializer extends ChannelInitializer { connection.setSessionHandler(new HandshakeSessionHandler(connection, this.server)); ch.pipeline().addLast(Connections.HANDLER, connection); - if (this.server.getConfiguration().isProxyProtocol()) { - ch.pipeline().addFirst(new HAProxyMessageDecoder()); - } + // TODO: Readd HAProxy support } } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/network/ServerChannelInitializerHolder.java b/proxy/src/main/java/com/velocitypowered/proxy/network/ServerChannelInitializerHolder.java index ab125cc8b..861ec3bc3 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/network/ServerChannelInitializerHolder.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/network/ServerChannelInitializerHolder.java @@ -17,8 +17,8 @@ package com.velocitypowered.proxy.network; -import io.netty.channel.Channel; -import io.netty.channel.ChannelInitializer; +import io.netty5.channel.Channel; +import io.netty5.channel.ChannelInitializer; import java.util.function.Supplier; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/network/TransportType.java b/proxy/src/main/java/com/velocitypowered/proxy/network/TransportType.java index 1082d1e97..21f0abb61 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/network/TransportType.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/network/TransportType.java @@ -18,46 +18,49 @@ package com.velocitypowered.proxy.network; import com.velocitypowered.proxy.util.concurrent.VelocityNettyThreadFactory; -import io.netty.channel.ChannelFactory; -import io.netty.channel.EventLoopGroup; -import io.netty.channel.epoll.Epoll; -import io.netty.channel.epoll.EpollDatagramChannel; -import io.netty.channel.epoll.EpollEventLoopGroup; -import io.netty.channel.epoll.EpollServerSocketChannel; -import io.netty.channel.epoll.EpollSocketChannel; -import io.netty.channel.nio.NioEventLoopGroup; -import io.netty.channel.socket.DatagramChannel; -import io.netty.channel.socket.ServerSocketChannel; -import io.netty.channel.socket.SocketChannel; -import io.netty.channel.socket.nio.NioDatagramChannel; -import io.netty.channel.socket.nio.NioServerSocketChannel; -import io.netty.channel.socket.nio.NioSocketChannel; +import io.netty5.channel.ChannelFactory; +import io.netty5.channel.EventLoopGroup; +import io.netty5.channel.MultithreadEventLoopGroup; +import io.netty5.channel.epoll.Epoll; +import io.netty5.channel.epoll.EpollDatagramChannel; +import io.netty5.channel.epoll.EpollHandler; +import io.netty5.channel.epoll.EpollServerSocketChannel; +import io.netty5.channel.epoll.EpollSocketChannel; +import io.netty5.channel.nio.NioHandler; +import io.netty5.channel.socket.DatagramChannel; +import io.netty5.channel.socket.ServerSocketChannel; +import io.netty5.channel.socket.SocketChannel; +import io.netty5.channel.socket.nio.NioDatagramChannel; +import io.netty5.channel.socket.nio.NioServerSocketChannel; +import io.netty5.channel.socket.nio.NioSocketChannel; import java.util.concurrent.ThreadFactory; import java.util.function.BiFunction; enum TransportType { - NIO("NIO", NioServerSocketChannel::new, + NIO("NIO", NioServerSocketChannel.class, NioSocketChannel::new, NioDatagramChannel::new, - (name, type) -> new NioEventLoopGroup(0, createThreadFactory(name, type))), - EPOLL("epoll", EpollServerSocketChannel::new, + (name, type) -> new MultithreadEventLoopGroup(0, + createThreadFactory(name, type), NioHandler.newFactory())), + EPOLL("epoll", EpollServerSocketChannel.class, EpollSocketChannel::new, EpollDatagramChannel::new, - (name, type) -> new EpollEventLoopGroup(0, createThreadFactory(name, type))); + (name, type) -> new MultithreadEventLoopGroup(0, + createThreadFactory(name, type), EpollHandler.newFactory())); final String name; - final ChannelFactory serverSocketChannelFactory; + final Class serverSocketChannelClass; final ChannelFactory socketChannelFactory; final ChannelFactory datagramChannelFactory; final BiFunction eventLoopGroupFactory; TransportType(final String name, - final ChannelFactory serverSocketChannelFactory, + final Class serverSocketChannelClass, final ChannelFactory socketChannelFactory, final ChannelFactory datagramChannelFactory, final BiFunction eventLoopGroupFactory) { this.name = name; - this.serverSocketChannelFactory = serverSocketChannelFactory; + this.serverSocketChannelClass = serverSocketChannelClass; this.socketChannelFactory = socketChannelFactory; this.datagramChannelFactory = datagramChannelFactory; this.eventLoopGroupFactory = eventLoopGroupFactory; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/network/netty/SeparatePoolInetNameResolver.java b/proxy/src/main/java/com/velocitypowered/proxy/network/netty/SeparatePoolInetNameResolver.java index a92fa3184..3f3e4ea71 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/network/netty/SeparatePoolInetNameResolver.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/network/netty/SeparatePoolInetNameResolver.java @@ -21,13 +21,13 @@ import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import com.google.common.collect.ImmutableList; import com.google.common.util.concurrent.ThreadFactoryBuilder; -import io.netty.resolver.AddressResolver; -import io.netty.resolver.AddressResolverGroup; -import io.netty.resolver.DefaultNameResolver; -import io.netty.resolver.InetNameResolver; -import io.netty.util.concurrent.EventExecutor; -import io.netty.util.concurrent.Future; -import io.netty.util.concurrent.Promise; +import io.netty5.resolver.AddressResolver; +import io.netty5.resolver.AddressResolverGroup; +import io.netty5.resolver.DefaultNameResolver; +import io.netty5.resolver.InetNameResolver; +import io.netty5.util.concurrent.EventExecutor; +import io.netty5.util.concurrent.Future; +import io.netty5.util.concurrent.Promise; import java.net.InetAddress; import java.net.InetSocketAddress; import java.util.List; @@ -70,18 +70,15 @@ public final class SeparatePoolInetNameResolver extends InetNameResolver { return; } - try { - resolveExecutor.execute(() -> { - promise.addListener(future -> { + resolveExecutor.execute(() -> this.delegate.resolve(inetHost) + .addListener(future -> { if (future.isSuccess()) { - cache.put(inetHost, ImmutableList.of((InetAddress) future.getNow())); + cache.put(inetHost, ImmutableList.of(future.getNow())); + promise.trySuccess(future.getNow()); + } else { + promise.tryFailure(future.cause()); } - }); - this.delegate.resolve(inetHost, promise); - }); - } catch (RejectedExecutionException e) { - promise.setFailure(e); - } + })); } @Override @@ -93,16 +90,16 @@ public final class SeparatePoolInetNameResolver extends InetNameResolver { return; } - try { - promise.addListener(future -> { - if (future.isSuccess()) { - cache.put(inetHost, (List) future.getNow()); - } - }); - resolveExecutor.execute(() -> this.delegate.resolveAll(inetHost, promise)); - } catch (RejectedExecutionException e) { - promise.setFailure(e); - } + resolveExecutor.execute(() -> this.delegate.resolve(inetHost) + .addListener(future -> { + if (future.isSuccess()) { + List addressList = ImmutableList.of(future.getNow()); + cache.put(inetHost, addressList); + promise.trySuccess(addressList); + } else { + promise.tryFailure(future.cause()); + } + })); } public void shutdown() { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/MinecraftPacket.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/MinecraftPacket.java index 7115bb8bf..e766264cf 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/MinecraftPacket.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/MinecraftPacket.java @@ -19,7 +19,7 @@ package com.velocitypowered.proxy.protocol; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; public interface MinecraftPacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/ProtocolUtils.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/ProtocolUtils.java index 53daae299..f2599b9aa 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/ProtocolUtils.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/ProtocolUtils.java @@ -25,13 +25,13 @@ import com.velocitypowered.api.util.GameProfile; import com.velocitypowered.proxy.protocol.netty.MinecraftDecoder; import com.velocitypowered.proxy.protocol.util.VelocityLegacyHoverEventSerializer; import com.velocitypowered.proxy.util.except.QuietDecoderException; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufInputStream; -import io.netty.buffer.ByteBufOutputStream; -import io.netty.buffer.ByteBufUtil; -import io.netty.handler.codec.CorruptedFrameException; -import io.netty.handler.codec.DecoderException; -import io.netty.handler.codec.EncoderException; +import io.netty5.buffer.ByteBuf; +import io.netty5.buffer.ByteBufInputStream; +import io.netty5.buffer.ByteBufOutputStream; +import io.netty5.buffer.ByteBufUtil; +import io.netty5.handler.codec.CorruptedFrameException; +import io.netty5.handler.codec.DecoderException; +import io.netty5.handler.codec.EncoderException; import java.io.DataInput; import java.io.DataOutput; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java index bab367e49..6a02bf5c0 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java @@ -70,8 +70,8 @@ import com.velocitypowered.proxy.protocol.packet.title.TitleSubtitlePacket; import com.velocitypowered.proxy.protocol.packet.title.TitleTextPacket; import com.velocitypowered.proxy.protocol.packet.title.TitleTimesPacket; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import io.netty.util.collection.IntObjectHashMap; -import io.netty.util.collection.IntObjectMap; +import io.netty5.util.collection.IntObjectHashMap; +import io.netty5.util.collection.IntObjectMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import java.util.Collections; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/AutoReadHolderHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/AutoReadHolderHandler.java index 9083f72a1..7560901da 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/AutoReadHolderHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/AutoReadHolderHandler.java @@ -17,17 +17,17 @@ package com.velocitypowered.proxy.protocol.netty; -import io.netty.channel.ChannelDuplexHandler; -import io.netty.channel.ChannelHandlerContext; -import io.netty.util.ReferenceCountUtil; +import io.netty5.channel.ChannelHandlerAdapter; +import io.netty5.channel.ChannelHandlerContext; +import io.netty5.util.ReferenceCountUtil; import java.util.ArrayDeque; import java.util.Queue; /** - * A variation on {@link io.netty.handler.flow.FlowControlHandler} that explicitly holds messages + * A variation on {@link io.netty5.handler.flow.FlowControlHandler} that explicitly holds messages * on {@code channelRead} and only releases them on an explicit read operation. */ -public class AutoReadHolderHandler extends ChannelDuplexHandler { +public class AutoReadHolderHandler extends ChannelHandlerAdapter { private final Queue queuedMessages; @@ -36,7 +36,7 @@ public class AutoReadHolderHandler extends ChannelDuplexHandler { } @Override - public void read(ChannelHandlerContext ctx) throws Exception { + public void read(ChannelHandlerContext ctx) { drainQueuedMessages(ctx); ctx.read(); } @@ -52,7 +52,7 @@ public class AutoReadHolderHandler extends ChannelDuplexHandler { } @Override - public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { + public void channelRead(ChannelHandlerContext ctx, Object msg) { if (ctx.channel().config().isAutoRead()) { ctx.fireChannelRead(msg); } else { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/GS4QueryHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/GS4QueryHandler.java index ff4a63b24..656ec7fc0 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/GS4QueryHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/GS4QueryHandler.java @@ -30,10 +30,10 @@ import com.velocitypowered.api.plugin.PluginDescription; import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.server.QueryResponse; import com.velocitypowered.proxy.VelocityServer; -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.SimpleChannelInboundHandler; -import io.netty.channel.socket.DatagramPacket; +import io.netty5.buffer.ByteBuf; +import io.netty5.channel.ChannelHandlerContext; +import io.netty5.channel.SimpleChannelInboundHandler; +import io.netty5.channel.socket.DatagramPacket; import java.net.InetAddress; import java.nio.charset.StandardCharsets; import java.security.SecureRandom; @@ -45,7 +45,7 @@ import java.util.List; import java.util.Optional; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer; +import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; import org.apache.logging.log4j.LogManager; public class GS4QueryHandler extends SimpleChannelInboundHandler { @@ -83,7 +83,8 @@ public class GS4QueryHandler extends SimpleChannelInboundHandler private QueryResponse createInitialResponse() { return QueryResponse.builder() - .hostname(PlainComponentSerializer.plain().serialize(server.getConfiguration().getMotd())) + .hostname(PlainTextComponentSerializer.plainText() + .serialize(server.getConfiguration().getMotd())) .gameVersion(ProtocolVersion.SUPPORTED_VERSION_STRING) .map(server.getConfiguration().getQueryMap()) .currentPlayers(server.getPlayerCount()) @@ -100,7 +101,7 @@ public class GS4QueryHandler extends SimpleChannelInboundHandler } @Override - protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception { + protected void messageReceived(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception { ByteBuf queryMessage = msg.content(); InetAddress senderAddress = msg.sender().getAddress(); @@ -127,7 +128,7 @@ public class GS4QueryHandler extends SimpleChannelInboundHandler writeString(queryResponse, Integer.toString(challengeToken)); DatagramPacket responsePacket = new DatagramPacket(queryResponse, msg.sender()); - ctx.writeAndFlush(responsePacket, ctx.voidPromise()); + ctx.writeAndFlush(responsePacket); break; } @@ -179,8 +180,8 @@ public class GS4QueryHandler extends SimpleChannelInboundHandler // Send the response DatagramPacket responsePacket = new DatagramPacket(queryResponse, msg.sender()); - ctx.writeAndFlush(responsePacket, ctx.voidPromise()); - }, ctx.channel().eventLoop()) + ctx.writeAndFlush(responsePacket); + }, ctx.channel().executor()) .exceptionally((ex) -> { LogManager.getLogger(getClass()).error( "Exception while writing GS4 response for query from {}", senderAddress, ex); diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/LegacyPingDecoder.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/LegacyPingDecoder.java index be716ec29..56e0a9413 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/LegacyPingDecoder.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/LegacyPingDecoder.java @@ -22,9 +22,9 @@ import static com.velocitypowered.proxy.protocol.util.NettyPreconditions.checkFr import com.velocitypowered.proxy.protocol.packet.LegacyHandshake; import com.velocitypowered.proxy.protocol.packet.LegacyPing; import com.velocitypowered.proxy.protocol.packet.legacyping.LegacyMinecraftPingVersion; -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.ByteToMessageDecoder; +import io.netty5.buffer.ByteBuf; +import io.netty5.channel.ChannelHandlerContext; +import io.netty5.handler.codec.ByteToMessageDecoder; import java.net.InetSocketAddress; import java.nio.charset.StandardCharsets; import java.util.List; @@ -34,7 +34,7 @@ public class LegacyPingDecoder extends ByteToMessageDecoder { private static final String MC_1_6_CHANNEL = "MC|PingHost"; @Override - protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) throws Exception { + protected void decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception { if (!in.isReadable()) { return; } @@ -49,21 +49,21 @@ public class LegacyPingDecoder extends ByteToMessageDecoder { if (first == 0xfe) { // possibly a ping if (!in.isReadable()) { - out.add(new LegacyPing(LegacyMinecraftPingVersion.MINECRAFT_1_3)); + ctx.fireChannelRead(new LegacyPing(LegacyMinecraftPingVersion.MINECRAFT_1_3)); return; } short next = in.readUnsignedByte(); if (next == 1 && !in.isReadable()) { - out.add(new LegacyPing(LegacyMinecraftPingVersion.MINECRAFT_1_4)); + ctx.fireChannelRead(new LegacyPing(LegacyMinecraftPingVersion.MINECRAFT_1_4)); return; } // We got a 1.6.x ping. Let's chomp off the stuff we don't need. - out.add(readExtended16Data(in)); + ctx.fireChannelRead(readExtended16Data(in)); } else if (first == 0x02 && in.isReadable()) { in.skipBytes(in.readableBytes()); - out.add(new LegacyHandshake()); + ctx.fireChannelRead(new LegacyHandshake()); } else { in.readerIndex(originalReaderIndex); ctx.pipeline().remove(this); diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/LegacyPingEncoder.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/LegacyPingEncoder.java index 1383493b9..6a726bf41 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/LegacyPingEncoder.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/LegacyPingEncoder.java @@ -18,10 +18,10 @@ package com.velocitypowered.proxy.protocol.netty; import com.velocitypowered.proxy.protocol.packet.LegacyDisconnect; -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandler; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.MessageToByteEncoder; +import io.netty5.buffer.ByteBuf; +import io.netty5.channel.ChannelHandler; +import io.netty5.channel.ChannelHandlerContext; +import io.netty5.handler.codec.MessageToByteEncoder; import java.nio.charset.StandardCharsets; @ChannelHandler.Sharable diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCipherDecoder.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCipherDecoder.java index 1f662fd57..872bae1b0 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCipherDecoder.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCipherDecoder.java @@ -20,9 +20,9 @@ package com.velocitypowered.proxy.protocol.netty; import com.google.common.base.Preconditions; import com.velocitypowered.natives.encryption.VelocityCipher; import com.velocitypowered.natives.util.MoreByteBufUtils; -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.MessageToMessageDecoder; +import io.netty5.buffer.ByteBuf; +import io.netty5.channel.ChannelHandlerContext; +import io.netty5.handler.codec.MessageToMessageDecoder; import java.util.List; public class MinecraftCipherDecoder extends MessageToMessageDecoder { @@ -34,11 +34,11 @@ public class MinecraftCipherDecoder extends MessageToMessageDecoder { } @Override - protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) throws Exception { + protected void decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception { ByteBuf compatible = MoreByteBufUtils.ensureCompatible(ctx.alloc(), cipher, in).slice(); try { cipher.process(compatible); - out.add(compatible); + ctx.fireChannelRead(compatible); } catch (Exception e) { compatible.release(); // compatible will never be used if we throw an exception throw e; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCipherEncoder.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCipherEncoder.java index b4fd027ec..7fe125f75 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCipherEncoder.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCipherEncoder.java @@ -20,9 +20,9 @@ package com.velocitypowered.proxy.protocol.netty; import com.google.common.base.Preconditions; import com.velocitypowered.natives.encryption.VelocityCipher; import com.velocitypowered.natives.util.MoreByteBufUtils; -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.MessageToMessageEncoder; +import io.netty5.buffer.ByteBuf; +import io.netty5.channel.ChannelHandlerContext; +import io.netty5.handler.codec.MessageToMessageEncoder; import java.util.List; public class MinecraftCipherEncoder extends MessageToMessageEncoder { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCompressDecoder.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCompressDecoder.java index 82fb4c153..240f04c02 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCompressDecoder.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCompressDecoder.java @@ -23,9 +23,9 @@ import static com.velocitypowered.proxy.protocol.util.NettyPreconditions.checkFr import com.velocitypowered.natives.compression.VelocityCompressor; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.MessageToMessageDecoder; +import io.netty5.buffer.ByteBuf; +import io.netty5.channel.ChannelHandlerContext; +import io.netty5.handler.codec.MessageToMessageDecoder; import java.util.List; public class MinecraftCompressDecoder extends MessageToMessageDecoder { @@ -46,11 +46,11 @@ public class MinecraftCompressDecoder extends MessageToMessageDecoder { } @Override - protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) throws Exception { + protected void decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception { int claimedUncompressedSize = ProtocolUtils.readVarInt(in); if (claimedUncompressedSize == 0) { // This message is not compressed. - out.add(in.retain()); + ctx.fireChannelRead(in.retain()); return; } @@ -64,7 +64,7 @@ public class MinecraftCompressDecoder extends MessageToMessageDecoder { ByteBuf uncompressed = preferredBuffer(ctx.alloc(), compressor, claimedUncompressedSize); try { compressor.inflate(compatibleIn, uncompressed, claimedUncompressedSize); - out.add(uncompressed); + ctx.fireChannelRead(uncompressed); } catch (Exception e) { uncompressed.release(); throw e; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCompressorAndLengthEncoder.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCompressorAndLengthEncoder.java index 67ec9e1e2..4865c42e9 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCompressorAndLengthEncoder.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCompressorAndLengthEncoder.java @@ -22,9 +22,9 @@ import static com.velocitypowered.proxy.protocol.netty.MinecraftVarintLengthEnco import com.velocitypowered.natives.compression.VelocityCompressor; import com.velocitypowered.natives.util.MoreByteBufUtils; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.MessageToByteEncoder; +import io.netty5.buffer.ByteBuf; +import io.netty5.channel.ChannelHandlerContext; +import io.netty5.handler.codec.MessageToByteEncoder; import java.util.zip.DataFormatException; public class MinecraftCompressorAndLengthEncoder extends MessageToByteEncoder { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftDecoder.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftDecoder.java index 5243a6796..c34b7e492 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftDecoder.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftDecoder.java @@ -23,12 +23,12 @@ import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.util.except.QuietRuntimeException; -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.ChannelInboundHandlerAdapter; -import io.netty.handler.codec.CorruptedFrameException; +import io.netty5.buffer.ByteBuf; +import io.netty5.channel.ChannelHandlerAdapter; +import io.netty5.channel.ChannelHandlerContext; +import io.netty5.handler.codec.CorruptedFrameException; -public class MinecraftDecoder extends ChannelInboundHandlerAdapter { +public class MinecraftDecoder extends ChannelHandlerAdapter { public static final boolean DEBUG = Boolean.getBoolean("velocity.packet-decode-logging"); private static final QuietRuntimeException DECODE_FAILED = diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftEncoder.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftEncoder.java index 7ed59202b..4958a72a8 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftEncoder.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftEncoder.java @@ -22,9 +22,9 @@ import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.StateRegistry; -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.MessageToByteEncoder; +import io.netty5.buffer.ByteBuf; +import io.netty5.channel.ChannelHandlerContext; +import io.netty5.handler.codec.MessageToByteEncoder; public class MinecraftEncoder extends MessageToByteEncoder { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftVarintFrameDecoder.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftVarintFrameDecoder.java index 675ddf7f7..4cd2a12cd 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftVarintFrameDecoder.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftVarintFrameDecoder.java @@ -19,9 +19,9 @@ package com.velocitypowered.proxy.protocol.netty; import com.velocitypowered.proxy.protocol.netty.VarintByteDecoder.DecodeResult; import com.velocitypowered.proxy.util.except.QuietDecoderException; -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.ByteToMessageDecoder; +import io.netty5.buffer.ByteBuf; +import io.netty5.channel.ChannelHandlerContext; +import io.netty5.handler.codec.ByteToMessageDecoder; import java.util.List; public class MinecraftVarintFrameDecoder extends ByteToMessageDecoder { @@ -32,7 +32,7 @@ public class MinecraftVarintFrameDecoder extends ByteToMessageDecoder { new QuietDecoderException("VarInt too big"); @Override - protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) { + protected void decode(ChannelHandlerContext ctx, ByteBuf in) { if (!ctx.channel().isActive()) { in.clear(); return; @@ -66,7 +66,7 @@ public class MinecraftVarintFrameDecoder extends ByteToMessageDecoder { } else { int minimumRead = bytesRead + readVarint; if (in.isReadable(minimumRead)) { - out.add(in.retainedSlice(varintEnd + 1, readVarint)); + ctx.fireChannelRead(in.retainedSlice(varintEnd + 1, readVarint)); in.skipBytes(minimumRead); } } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftVarintLengthEncoder.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftVarintLengthEncoder.java index f65764bf0..a6114d3a4 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftVarintLengthEncoder.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftVarintLengthEncoder.java @@ -20,10 +20,10 @@ package com.velocitypowered.proxy.protocol.netty; import com.velocitypowered.natives.encryption.JavaVelocityCipher; import com.velocitypowered.natives.util.Natives; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandler; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.MessageToByteEncoder; +import io.netty5.buffer.ByteBuf; +import io.netty5.channel.ChannelHandler; +import io.netty5.channel.ChannelHandlerContext; +import io.netty5.handler.codec.MessageToByteEncoder; @ChannelHandler.Sharable public class MinecraftVarintLengthEncoder extends MessageToByteEncoder { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/VarintByteDecoder.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/VarintByteDecoder.java index a67371bea..c110004e6 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/VarintByteDecoder.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/VarintByteDecoder.java @@ -17,7 +17,7 @@ package com.velocitypowered.proxy.protocol.netty; -import io.netty.util.ByteProcessor; +import io.netty5.util.ByteProcessor; class VarintByteDecoder implements ByteProcessor { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/AvailableCommands.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/AvailableCommands.java index 39cfbdec3..4ed6b842e 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/AvailableCommands.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/AvailableCommands.java @@ -41,7 +41,7 @@ import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.ProtocolUtils.Direction; import com.velocitypowered.proxy.protocol.packet.brigadier.ArgumentPropertyRegistry; import com.velocitypowered.proxy.util.collect.IdentityHashStrategy; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenCustomHashMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import java.util.ArrayDeque; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/BossBar.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/BossBar.java index 4ba18272f..e86d0f62e 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/BossBar.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/BossBar.java @@ -21,7 +21,7 @@ import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import java.util.UUID; import org.checkerframework.checker.nullness.qual.Nullable; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Chat.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Chat.java index 5c628337c..bed002a1c 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Chat.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Chat.java @@ -22,7 +22,7 @@ import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import net.kyori.adventure.identity.Identity; import org.checkerframework.checker.nullness.qual.Nullable; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ClientSettings.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ClientSettings.java index f1e7d038a..b5ebec60c 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ClientSettings.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ClientSettings.java @@ -21,7 +21,7 @@ import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import org.checkerframework.checker.nullness.qual.Nullable; public class ClientSettings implements MinecraftPacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Disconnect.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Disconnect.java index 82528e708..d9f0fa003 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Disconnect.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Disconnect.java @@ -22,7 +22,7 @@ import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import org.checkerframework.checker.nullness.qual.Nullable; public class Disconnect implements MinecraftPacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/EncryptionRequest.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/EncryptionRequest.java index ff0cc5943..51d782337 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/EncryptionRequest.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/EncryptionRequest.java @@ -23,7 +23,7 @@ import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import java.util.Arrays; public class EncryptionRequest implements MinecraftPacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/EncryptionResponse.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/EncryptionResponse.java index 905ea05ae..ad52dbc81 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/EncryptionResponse.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/EncryptionResponse.java @@ -24,7 +24,7 @@ import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.ProtocolUtils.Direction; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import java.util.Arrays; public class EncryptionResponse implements MinecraftPacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Handshake.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Handshake.java index d2b425a72..381319720 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Handshake.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Handshake.java @@ -24,7 +24,7 @@ import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.forge.legacy.LegacyForgeConstants; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; public class Handshake implements MinecraftPacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/HeaderAndFooter.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/HeaderAndFooter.java index 8001012a4..2d55b9b58 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/HeaderAndFooter.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/HeaderAndFooter.java @@ -24,7 +24,7 @@ import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/JoinGame.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/JoinGame.java index 74e2956c0..18869b851 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/JoinGame.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/JoinGame.java @@ -24,7 +24,7 @@ import com.velocitypowered.proxy.connection.registry.DimensionData; import com.velocitypowered.proxy.connection.registry.DimensionInfo; import com.velocitypowered.proxy.connection.registry.DimensionRegistry; import com.velocitypowered.proxy.protocol.*; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import net.kyori.adventure.nbt.BinaryTagIO; import net.kyori.adventure.nbt.BinaryTagTypes; import net.kyori.adventure.nbt.CompoundBinaryTag; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/KeepAlive.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/KeepAlive.java index c2db00b92..fc457b0bb 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/KeepAlive.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/KeepAlive.java @@ -21,7 +21,7 @@ import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; public class KeepAlive implements MinecraftPacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LegacyHandshake.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LegacyHandshake.java index 00f37b2ec..7018737cf 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LegacyHandshake.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LegacyHandshake.java @@ -21,7 +21,7 @@ import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; public class LegacyHandshake implements MinecraftPacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LegacyPing.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LegacyPing.java index e404ed55a..abe2e997d 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LegacyPing.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LegacyPing.java @@ -22,7 +22,7 @@ import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.packet.legacyping.LegacyMinecraftPingVersion; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import java.net.InetSocketAddress; import org.checkerframework.checker.nullness.qual.Nullable; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LoginPluginMessage.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LoginPluginMessage.java index 0b57ca72e..893c5f6a5 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LoginPluginMessage.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LoginPluginMessage.java @@ -22,8 +22,8 @@ import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.util.DeferredByteBufHolder; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; +import io.netty5.buffer.ByteBuf; +import io.netty5.buffer.Unpooled; import org.checkerframework.checker.nullness.qual.Nullable; public class LoginPluginMessage extends DeferredByteBufHolder implements MinecraftPacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LoginPluginResponse.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LoginPluginResponse.java index 343446d5e..b77c4dd4b 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LoginPluginResponse.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LoginPluginResponse.java @@ -22,8 +22,8 @@ import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.util.DeferredByteBufHolder; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; +import io.netty5.buffer.ByteBuf; +import io.netty5.buffer.Unpooled; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; public class LoginPluginResponse extends DeferredByteBufHolder implements MinecraftPacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/PlayerListItem.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/PlayerListItem.java index 5aa667065..b03e1148c 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/PlayerListItem.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/PlayerListItem.java @@ -24,7 +24,7 @@ import com.velocitypowered.api.util.GameProfile; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import java.util.ArrayList; import java.util.List; import java.util.UUID; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/PluginMessage.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/PluginMessage.java index 9faaae04c..3cd513e55 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/PluginMessage.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/PluginMessage.java @@ -24,7 +24,7 @@ import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.util.DeferredByteBufHolder; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.Nullable; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ResourcePackRequest.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ResourcePackRequest.java index d17505560..f9047b137 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ResourcePackRequest.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ResourcePackRequest.java @@ -22,7 +22,7 @@ import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.ProtocolUtils.Direction; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ResourcePackResponse.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ResourcePackResponse.java index 53a9afffa..b68683c47 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ResourcePackResponse.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ResourcePackResponse.java @@ -23,7 +23,7 @@ import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.ProtocolUtils.Direction; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; public class ResourcePackResponse implements MinecraftPacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Respawn.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Respawn.java index 5b94a1df2..bcca50dd8 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Respawn.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Respawn.java @@ -23,7 +23,7 @@ import com.velocitypowered.proxy.connection.registry.DimensionData; import com.velocitypowered.proxy.connection.registry.DimensionInfo; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import net.kyori.adventure.nbt.BinaryTagIO; import net.kyori.adventure.nbt.CompoundBinaryTag; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLogin.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLogin.java index 57959c370..1411f9e6c 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLogin.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLogin.java @@ -24,7 +24,7 @@ import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.ProtocolUtils.Direction; import com.velocitypowered.proxy.util.except.QuietDecoderException; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import org.checkerframework.checker.nullness.qual.Nullable; public class ServerLogin implements MinecraftPacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLoginSuccess.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLoginSuccess.java index d0f415694..59d42ed73 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLoginSuccess.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLoginSuccess.java @@ -22,7 +22,7 @@ import com.velocitypowered.api.util.UuidUtils; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import java.util.UUID; import org.checkerframework.checker.nullness.qual.Nullable; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/SetCompression.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/SetCompression.java index 8a225de99..621cd6532 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/SetCompression.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/SetCompression.java @@ -21,7 +21,7 @@ import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; public class SetCompression implements MinecraftPacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusPing.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusPing.java index 94eb593fc..30c8c58c4 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusPing.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusPing.java @@ -22,7 +22,7 @@ import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.ProtocolUtils.Direction; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; public class StatusPing implements MinecraftPacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusRequest.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusRequest.java index d9fc74ec3..d54d0a20b 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusRequest.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusRequest.java @@ -22,7 +22,7 @@ import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.ProtocolUtils.Direction; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; public class StatusRequest implements MinecraftPacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusResponse.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusResponse.java index 303ec6fa9..08a424573 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusResponse.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusResponse.java @@ -21,7 +21,7 @@ import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import org.checkerframework.checker.nullness.qual.Nullable; public class StatusResponse implements MinecraftPacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TabCompleteRequest.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TabCompleteRequest.java index 90e415cb3..32b2a4072 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TabCompleteRequest.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TabCompleteRequest.java @@ -26,7 +26,7 @@ import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import org.checkerframework.checker.nullness.qual.Nullable; public class TabCompleteRequest implements MinecraftPacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TabCompleteResponse.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TabCompleteResponse.java index c983fed84..4388fb310 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TabCompleteResponse.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TabCompleteResponse.java @@ -24,7 +24,7 @@ import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import java.util.ArrayList; import java.util.List; import net.kyori.adventure.text.Component; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentPropertyRegistry.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentPropertyRegistry.java index 1f5aa3678..eee02dd39 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentPropertyRegistry.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentPropertyRegistry.java @@ -33,7 +33,7 @@ import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.arguments.LongArgumentType; import com.mojang.brigadier.arguments.StringArgumentType; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import java.util.HashMap; import java.util.Map; import org.checkerframework.checker.nullness.qual.Nullable; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentPropertySerializer.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentPropertySerializer.java index 0dbc66dce..9150c191a 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentPropertySerializer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentPropertySerializer.java @@ -17,7 +17,7 @@ package com.velocitypowered.proxy.protocol.packet.brigadier; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import org.checkerframework.checker.nullness.qual.Nullable; public interface ArgumentPropertySerializer { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ByteArgumentPropertySerializer.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ByteArgumentPropertySerializer.java index a6d24c645..b7ac2b5b4 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ByteArgumentPropertySerializer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ByteArgumentPropertySerializer.java @@ -17,7 +17,7 @@ package com.velocitypowered.proxy.protocol.packet.brigadier; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; class ByteArgumentPropertySerializer implements ArgumentPropertySerializer { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/DoubleArgumentPropertySerializer.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/DoubleArgumentPropertySerializer.java index 2162a980e..c00938100 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/DoubleArgumentPropertySerializer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/DoubleArgumentPropertySerializer.java @@ -22,7 +22,7 @@ import static com.velocitypowered.proxy.protocol.packet.brigadier.IntegerArgumen import static com.velocitypowered.proxy.protocol.packet.brigadier.IntegerArgumentPropertySerializer.getFlags; import com.mojang.brigadier.arguments.DoubleArgumentType; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; class DoubleArgumentPropertySerializer implements ArgumentPropertySerializer { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/EmptyArgumentPropertySerializer.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/EmptyArgumentPropertySerializer.java index 4338381da..82a6549ab 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/EmptyArgumentPropertySerializer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/EmptyArgumentPropertySerializer.java @@ -17,7 +17,7 @@ package com.velocitypowered.proxy.protocol.packet.brigadier; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import org.checkerframework.checker.nullness.qual.Nullable; /** diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/FloatArgumentPropertySerializer.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/FloatArgumentPropertySerializer.java index 2f5b9bc98..45b0d97d1 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/FloatArgumentPropertySerializer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/FloatArgumentPropertySerializer.java @@ -22,7 +22,7 @@ import static com.velocitypowered.proxy.protocol.packet.brigadier.IntegerArgumen import static com.velocitypowered.proxy.protocol.packet.brigadier.IntegerArgumentPropertySerializer.getFlags; import com.mojang.brigadier.arguments.FloatArgumentType; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; class FloatArgumentPropertySerializer implements ArgumentPropertySerializer { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/IntegerArgumentPropertySerializer.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/IntegerArgumentPropertySerializer.java index 333d653f8..0576bfdd5 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/IntegerArgumentPropertySerializer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/IntegerArgumentPropertySerializer.java @@ -18,7 +18,7 @@ package com.velocitypowered.proxy.protocol.packet.brigadier; import com.mojang.brigadier.arguments.IntegerArgumentType; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; class IntegerArgumentPropertySerializer implements ArgumentPropertySerializer { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/LongArgumentPropertySerializer.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/LongArgumentPropertySerializer.java index f2b37ac34..7116aee0e 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/LongArgumentPropertySerializer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/LongArgumentPropertySerializer.java @@ -22,7 +22,7 @@ import static com.velocitypowered.proxy.protocol.packet.brigadier.IntegerArgumen import static com.velocitypowered.proxy.protocol.packet.brigadier.IntegerArgumentPropertySerializer.getFlags; import com.mojang.brigadier.arguments.LongArgumentType; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; class LongArgumentPropertySerializer implements ArgumentPropertySerializer { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ModArgumentProperty.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ModArgumentProperty.java index cf6283b26..aa631c438 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ModArgumentProperty.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ModArgumentProperty.java @@ -23,8 +23,8 @@ import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; +import io.netty5.buffer.ByteBuf; +import io.netty5.buffer.Unpooled; import java.util.Collection; import java.util.concurrent.CompletableFuture; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ModArgumentPropertySerializer.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ModArgumentPropertySerializer.java index 58b65b98d..002538b04 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ModArgumentPropertySerializer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ModArgumentPropertySerializer.java @@ -18,8 +18,8 @@ package com.velocitypowered.proxy.protocol.packet.brigadier; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; +import io.netty5.buffer.ByteBuf; +import io.netty5.buffer.Unpooled; import org.checkerframework.checker.nullness.qual.Nullable; class ModArgumentPropertySerializer implements ArgumentPropertySerializer { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/RegistryKeyArgumentSerializer.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/RegistryKeyArgumentSerializer.java index e8ea99215..476ef227f 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/RegistryKeyArgumentSerializer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/RegistryKeyArgumentSerializer.java @@ -19,7 +19,7 @@ package com.velocitypowered.proxy.protocol.packet.brigadier; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; public class RegistryKeyArgumentSerializer implements ArgumentPropertySerializer { static final RegistryKeyArgumentSerializer REGISTRY = new RegistryKeyArgumentSerializer(); diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/StringArgumentPropertySerializer.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/StringArgumentPropertySerializer.java index 790eee12d..1bdea90b7 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/StringArgumentPropertySerializer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/StringArgumentPropertySerializer.java @@ -19,7 +19,7 @@ package com.velocitypowered.proxy.protocol.packet.brigadier; import com.mojang.brigadier.arguments.StringArgumentType; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; /** * Serializes properties for {@link StringArgumentType}. diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/GenericTitlePacket.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/GenericTitlePacket.java index 38c890c03..bef90e9f3 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/GenericTitlePacket.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/GenericTitlePacket.java @@ -20,7 +20,7 @@ package com.velocitypowered.proxy.protocol.packet.title; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import org.checkerframework.checker.nullness.qual.Nullable; public abstract class GenericTitlePacket implements MinecraftPacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/LegacyTitlePacket.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/LegacyTitlePacket.java index 7b25325e6..b3c82ba51 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/LegacyTitlePacket.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/LegacyTitlePacket.java @@ -20,7 +20,7 @@ package com.velocitypowered.proxy.protocol.packet.title; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import org.checkerframework.checker.nullness.qual.Nullable; public class LegacyTitlePacket extends GenericTitlePacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/TitleActionbarPacket.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/TitleActionbarPacket.java index e875ae3cd..6b0824e85 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/TitleActionbarPacket.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/TitleActionbarPacket.java @@ -20,7 +20,7 @@ package com.velocitypowered.proxy.protocol.packet.title; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; public class TitleActionbarPacket extends GenericTitlePacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/TitleClearPacket.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/TitleClearPacket.java index 626abb517..db3138420 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/TitleClearPacket.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/TitleClearPacket.java @@ -20,7 +20,7 @@ package com.velocitypowered.proxy.protocol.packet.title; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; public class TitleClearPacket extends GenericTitlePacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/TitleSubtitlePacket.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/TitleSubtitlePacket.java index 1640862f7..12f2acc94 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/TitleSubtitlePacket.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/TitleSubtitlePacket.java @@ -20,7 +20,7 @@ package com.velocitypowered.proxy.protocol.packet.title; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; public class TitleSubtitlePacket extends GenericTitlePacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/TitleTextPacket.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/TitleTextPacket.java index 135eb27e4..ef9268841 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/TitleTextPacket.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/TitleTextPacket.java @@ -20,7 +20,7 @@ package com.velocitypowered.proxy.protocol.packet.title; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; public class TitleTextPacket extends GenericTitlePacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/TitleTimesPacket.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/TitleTimesPacket.java index 7450caccd..8629cbeb2 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/TitleTimesPacket.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/title/TitleTimesPacket.java @@ -20,7 +20,7 @@ package com.velocitypowered.proxy.protocol.packet.title; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.ProtocolUtils; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; public class TitleTimesPacket extends GenericTitlePacket { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/ByteBufDataInput.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/ByteBufDataInput.java index 667d1a0c5..75b2939cc 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/ByteBufDataInput.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/ByteBufDataInput.java @@ -18,12 +18,12 @@ package com.velocitypowered.proxy.protocol.util; import com.google.common.io.ByteArrayDataInput; -import io.netty.buffer.ByteBuf; +import io.netty5.buffer.ByteBuf; import java.io.DataInputStream; import java.io.IOException; /** - * A wrapper around {@link io.netty.buffer.ByteBuf} that implements the exception-free + * A wrapper around {@link io.netty5.buffer.ByteBuf} that implements the exception-free * {@link ByteArrayDataInput} interface from Guava. */ public class ByteBufDataInput implements ByteArrayDataInput { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/ByteBufDataOutput.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/ByteBufDataOutput.java index e7ff5d621..ff0f101d8 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/ByteBufDataOutput.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/ByteBufDataOutput.java @@ -18,8 +18,8 @@ package com.velocitypowered.proxy.protocol.util; import com.google.common.io.ByteArrayDataOutput; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; +import io.netty5.buffer.ByteBuf; +import io.netty5.buffer.ByteBufUtil; import java.io.DataOutput; import java.io.DataOutputStream; import java.io.IOException; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/DeferredByteBufHolder.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/DeferredByteBufHolder.java index b6655bc23..f387073c6 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/DeferredByteBufHolder.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/DeferredByteBufHolder.java @@ -17,9 +17,9 @@ package com.velocitypowered.proxy.protocol.util; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufHolder; -import io.netty.util.IllegalReferenceCountException; +import io.netty5.buffer.ByteBuf; +import io.netty5.buffer.ByteBufHolder; +import io.netty5.util.IllegalReferenceCountException; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; /** diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/NettyPreconditions.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/NettyPreconditions.java index 52bdb75dc..fb548559e 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/NettyPreconditions.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/NettyPreconditions.java @@ -20,7 +20,7 @@ package com.velocitypowered.proxy.protocol.util; import com.google.common.base.Strings; import com.velocitypowered.proxy.protocol.netty.MinecraftDecoder; import com.velocitypowered.proxy.util.except.QuietDecoderException; -import io.netty.handler.codec.CorruptedFrameException; +import io.netty5.handler.codec.CorruptedFrameException; /** * Extends {@link com.google.common.base.Preconditions} for Netty's {@link CorruptedFrameException}. diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/PluginMessageUtil.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/PluginMessageUtil.java index 51787428c..64e06a9a3 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/PluginMessageUtil.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/util/PluginMessageUtil.java @@ -25,8 +25,8 @@ import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.util.ProxyVersion; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.packet.PluginMessage; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; +import io.netty5.buffer.ByteBuf; +import io.netty5.buffer.Unpooled; import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.List; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/server/VelocityRegisteredServer.java b/proxy/src/main/java/com/velocitypowered/proxy/server/VelocityRegisteredServer.java index af49cf1e2..90709f803 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/server/VelocityRegisteredServer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/server/VelocityRegisteredServer.java @@ -41,13 +41,12 @@ import com.velocitypowered.proxy.protocol.netty.MinecraftDecoder; import com.velocitypowered.proxy.protocol.netty.MinecraftEncoder; import com.velocitypowered.proxy.protocol.netty.MinecraftVarintFrameDecoder; import com.velocitypowered.proxy.protocol.netty.MinecraftVarintLengthEncoder; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.channel.Channel; -import io.netty.channel.ChannelFutureListener; -import io.netty.channel.ChannelInitializer; -import io.netty.channel.EventLoop; -import io.netty.handler.timeout.ReadTimeoutHandler; +import io.netty5.buffer.ByteBuf; +import io.netty5.buffer.Unpooled; +import io.netty5.channel.Channel; +import io.netty5.channel.ChannelInitializer; +import io.netty5.channel.EventLoop; +import io.netty5.handler.timeout.ReadTimeoutHandler; import java.util.Collection; import java.util.Map; import java.util.UUID; @@ -116,9 +115,9 @@ public class VelocityRegisteredServer implements RegisteredServer, ForwardingAud } }) .connect(serverInfo.getAddress()) - .addListener((ChannelFutureListener) future -> { + .addListener(future -> { if (future.isSuccess()) { - MinecraftConnection conn = future.channel().pipeline().get(MinecraftConnection.class); + MinecraftConnection conn = future.getNow().pipeline().get(MinecraftConnection.class); conn.setSessionHandler(new PingSessionHandler( pingFuture, VelocityRegisteredServer.this, conn, version)); } else { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/util/concurrent/VelocityNettyThreadFactory.java b/proxy/src/main/java/com/velocitypowered/proxy/util/concurrent/VelocityNettyThreadFactory.java index 4ac6a48c3..63adff774 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/util/concurrent/VelocityNettyThreadFactory.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/util/concurrent/VelocityNettyThreadFactory.java @@ -19,7 +19,7 @@ package com.velocitypowered.proxy.util.concurrent; import static com.google.common.base.Preconditions.checkNotNull; -import io.netty.util.concurrent.FastThreadLocalThread; +import io.netty5.util.concurrent.FastThreadLocalThread; import java.util.concurrent.ThreadFactory; import java.util.concurrent.atomic.AtomicInteger; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/util/except/QuietDecoderException.java b/proxy/src/main/java/com/velocitypowered/proxy/util/except/QuietDecoderException.java index 441e1f3de..11b80d0fa 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/util/except/QuietDecoderException.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/util/except/QuietDecoderException.java @@ -17,7 +17,7 @@ package com.velocitypowered.proxy.util.except; -import io.netty.handler.codec.DecoderException; +import io.netty5.handler.codec.DecoderException; /** * A special-purpose exception thrown when we want to indicate an error decoding but do not want diff --git a/proxy/src/test/java/com/velocitypowered/proxy/protocol/ProtocolUtilsTest.java b/proxy/src/test/java/com/velocitypowered/proxy/protocol/ProtocolUtilsTest.java index 04b2f3193..40394ab7f 100644 --- a/proxy/src/test/java/com/velocitypowered/proxy/protocol/ProtocolUtilsTest.java +++ b/proxy/src/test/java/com/velocitypowered/proxy/protocol/ProtocolUtilsTest.java @@ -21,9 +21,9 @@ import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; -import io.netty.buffer.Unpooled; +import io.netty5.buffer.ByteBuf; +import io.netty5.buffer.ByteBufUtil; +import io.netty5.buffer.Unpooled; import org.junit.jupiter.api.Test; public class ProtocolUtilsTest {