From ba7ba70f4b4fc08b569cc29a2016739c4e78d276 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sun, 21 Feb 2021 21:03:06 -0500 Subject: [PATCH] Connections -> HandlerNames --- .../proxy/connection/MinecraftConnection.java | 18 ++++++++---------- .../backend/VelocityServerConnection.java | 2 +- .../network/BackendChannelInitializer.java | 12 ++++++------ .../{Connections.java => HandlerNames.java} | 4 ++-- .../network/ServerChannelInitializer.java | 16 ++++++++-------- .../proxy/server/VelocityRegisteredServer.java | 12 ++++++------ 6 files changed, 31 insertions(+), 33 deletions(-) rename proxy/src/main/java/com/velocitypowered/proxy/network/{Connections.java => HandlerNames.java} (94%) 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 25c87c823..65e49311a 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java @@ -1,13 +1,13 @@ package com.velocitypowered.proxy.connection; -import static com.velocitypowered.proxy.network.Connections.CIPHER_DECODER; -import static com.velocitypowered.proxy.network.Connections.CIPHER_ENCODER; -import static com.velocitypowered.proxy.network.Connections.COMPRESSION_DECODER; -import static com.velocitypowered.proxy.network.Connections.COMPRESSION_ENCODER; -import static com.velocitypowered.proxy.network.Connections.FRAME_DECODER; -import static com.velocitypowered.proxy.network.Connections.FRAME_ENCODER; -import static com.velocitypowered.proxy.network.Connections.MINECRAFT_DECODER; -import static com.velocitypowered.proxy.network.Connections.MINECRAFT_ENCODER; +import static com.velocitypowered.proxy.network.HandlerNames.CIPHER_DECODER; +import static com.velocitypowered.proxy.network.HandlerNames.CIPHER_ENCODER; +import static com.velocitypowered.proxy.network.HandlerNames.COMPRESSION_DECODER; +import static com.velocitypowered.proxy.network.HandlerNames.COMPRESSION_ENCODER; +import static com.velocitypowered.proxy.network.HandlerNames.FRAME_DECODER; +import static com.velocitypowered.proxy.network.HandlerNames.FRAME_ENCODER; +import static com.velocitypowered.proxy.network.HandlerNames.MINECRAFT_DECODER; +import static com.velocitypowered.proxy.network.HandlerNames.MINECRAFT_ENCODER; import com.google.common.base.Preconditions; import com.velocitypowered.api.network.ProtocolVersion; @@ -31,7 +31,6 @@ import com.velocitypowered.proxy.network.pipeline.MinecraftEncoder; import com.velocitypowered.proxy.util.except.QuietDecoderException; import io.netty.buffer.ByteBuf; import io.netty.channel.Channel; -import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; @@ -48,7 +47,6 @@ import javax.crypto.spec.SecretKeySpec; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.checkerframework.checker.nullness.qual.Nullable; -import org.jetbrains.annotations.NotNull; /** * A utility class to make working with the pipeline a little less painful and transparently handles 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 cfae1dd68..cf5bb90bc 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 @@ -2,7 +2,7 @@ package com.velocitypowered.proxy.connection.backend; import static com.velocitypowered.proxy.VelocityServer.GENERAL_GSON; import static com.velocitypowered.proxy.connection.forge.legacy.LegacyForgeConstants.HANDSHAKE_HOSTNAME_TOKEN; -import static com.velocitypowered.proxy.network.Connections.HANDLER; +import static com.velocitypowered.proxy.network.HandlerNames.HANDLER; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; 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 607e26fee..df37a12f9 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/network/BackendChannelInitializer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/network/BackendChannelInitializer.java @@ -1,11 +1,11 @@ package com.velocitypowered.proxy.network; -import static com.velocitypowered.proxy.network.Connections.FLOW_HANDLER; -import static com.velocitypowered.proxy.network.Connections.FRAME_DECODER; -import static com.velocitypowered.proxy.network.Connections.FRAME_ENCODER; -import static com.velocitypowered.proxy.network.Connections.MINECRAFT_DECODER; -import static com.velocitypowered.proxy.network.Connections.MINECRAFT_ENCODER; -import static com.velocitypowered.proxy.network.Connections.READ_TIMEOUT; +import static com.velocitypowered.proxy.network.HandlerNames.FLOW_HANDLER; +import static com.velocitypowered.proxy.network.HandlerNames.FRAME_DECODER; +import static com.velocitypowered.proxy.network.HandlerNames.FRAME_ENCODER; +import static com.velocitypowered.proxy.network.HandlerNames.MINECRAFT_DECODER; +import static com.velocitypowered.proxy.network.HandlerNames.MINECRAFT_ENCODER; +import static com.velocitypowered.proxy.network.HandlerNames.READ_TIMEOUT; import com.velocitypowered.proxy.VelocityServer; import com.velocitypowered.proxy.network.packet.PacketDirection; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/network/Connections.java b/proxy/src/main/java/com/velocitypowered/proxy/network/HandlerNames.java similarity index 94% rename from proxy/src/main/java/com/velocitypowered/proxy/network/Connections.java rename to proxy/src/main/java/com/velocitypowered/proxy/network/HandlerNames.java index 33112a089..2d21b3653 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/network/Connections.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/network/HandlerNames.java @@ -1,6 +1,6 @@ package com.velocitypowered.proxy.network; -public class Connections { +public class HandlerNames { public static final String CIPHER_DECODER = "cipher-decoder"; public static final String CIPHER_ENCODER = "cipher-encoder"; @@ -16,7 +16,7 @@ public class Connections { public static final String MINECRAFT_ENCODER = "minecraft-encoder"; public static final String READ_TIMEOUT = "read-timeout"; - private Connections() { + private HandlerNames() { throw new AssertionError(); } } 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 06c1d11e0..ad64f84e4 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/network/ServerChannelInitializer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/network/ServerChannelInitializer.java @@ -1,12 +1,12 @@ package com.velocitypowered.proxy.network; -import static com.velocitypowered.proxy.network.Connections.FRAME_DECODER; -import static com.velocitypowered.proxy.network.Connections.FRAME_ENCODER; -import static com.velocitypowered.proxy.network.Connections.LEGACY_PING_DECODER; -import static com.velocitypowered.proxy.network.Connections.LEGACY_PING_ENCODER; -import static com.velocitypowered.proxy.network.Connections.MINECRAFT_DECODER; -import static com.velocitypowered.proxy.network.Connections.MINECRAFT_ENCODER; -import static com.velocitypowered.proxy.network.Connections.READ_TIMEOUT; +import static com.velocitypowered.proxy.network.HandlerNames.FRAME_DECODER; +import static com.velocitypowered.proxy.network.HandlerNames.FRAME_ENCODER; +import static com.velocitypowered.proxy.network.HandlerNames.LEGACY_PING_DECODER; +import static com.velocitypowered.proxy.network.HandlerNames.LEGACY_PING_ENCODER; +import static com.velocitypowered.proxy.network.HandlerNames.MINECRAFT_DECODER; +import static com.velocitypowered.proxy.network.HandlerNames.MINECRAFT_ENCODER; +import static com.velocitypowered.proxy.network.HandlerNames.READ_TIMEOUT; import com.velocitypowered.proxy.VelocityServer; import com.velocitypowered.proxy.connection.MinecraftConnection; @@ -48,7 +48,7 @@ public class ServerChannelInitializer extends ChannelInitializer { final MinecraftConnection connection = new MinecraftConnection(ch, this.server); connection.setSessionHandler(new HandshakeSessionHandler(connection, this.server)); - ch.pipeline().addLast(Connections.HANDLER, connection); + ch.pipeline().addLast(HandlerNames.HANDLER, connection); if (this.server.getConfiguration().isProxyProtocol()) { ch.pipeline().addFirst(new HAProxyMessageDecoder()); 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 94433a24c..ffd7930fd 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/server/VelocityRegisteredServer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/server/VelocityRegisteredServer.java @@ -1,11 +1,11 @@ package com.velocitypowered.proxy.server; -import static com.velocitypowered.proxy.network.Connections.FRAME_DECODER; -import static com.velocitypowered.proxy.network.Connections.FRAME_ENCODER; -import static com.velocitypowered.proxy.network.Connections.HANDLER; -import static com.velocitypowered.proxy.network.Connections.MINECRAFT_DECODER; -import static com.velocitypowered.proxy.network.Connections.MINECRAFT_ENCODER; -import static com.velocitypowered.proxy.network.Connections.READ_TIMEOUT; +import static com.velocitypowered.proxy.network.HandlerNames.FRAME_DECODER; +import static com.velocitypowered.proxy.network.HandlerNames.FRAME_ENCODER; +import static com.velocitypowered.proxy.network.HandlerNames.HANDLER; +import static com.velocitypowered.proxy.network.HandlerNames.MINECRAFT_DECODER; +import static com.velocitypowered.proxy.network.HandlerNames.MINECRAFT_ENCODER; +import static com.velocitypowered.proxy.network.HandlerNames.READ_TIMEOUT; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList;