From 72f8052e5885052eceaf4717d62fc3c4bc75994d Mon Sep 17 00:00:00 2001 From: creeper123123321 <7974274+creeper123123321@users.noreply.github.com> Date: Wed, 5 Aug 2020 06:20:13 -0300 Subject: [PATCH] code cleanup --- .../myles/ViaVersion/api/data/UserConnection.java | 14 ++++++-------- .../velocity/platform/VelocityViaLoader.java | 2 -- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/api/data/UserConnection.java b/common/src/main/java/us/myles/ViaVersion/api/data/UserConnection.java index c3e662176..d37b39f69 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/data/UserConnection.java +++ b/common/src/main/java/us/myles/ViaVersion/api/data/UserConnection.java @@ -3,7 +3,6 @@ package us.myles.ViaVersion.api.data; import io.netty.buffer.ByteBuf; import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandlerContext; import net.md_5.bungee.api.ChatColor; import org.jetbrains.annotations.Nullable; @@ -26,9 +25,9 @@ public class UserConnection { private static final AtomicLong IDS = new AtomicLong(); private final long id = IDS.incrementAndGet(); private final Channel channel; - private ProtocolInfo protocolInfo; - Map storedObjects = new ConcurrentHashMap<>(); private final boolean clientSide; + Map storedObjects = new ConcurrentHashMap<>(); + private ProtocolInfo protocolInfo; private boolean active = true; private boolean pendingDisconnect; private Object lastPacket; @@ -44,7 +43,8 @@ public class UserConnection { /** * Creates an UserConnection. When it's a client-side connection, some method behaviors are modified. - * @param channel netty channel. + * + * @param channel netty channel. * @param clientSide true if it's a client-side connection */ public UserConnection(@Nullable Channel channel, boolean clientSide) { @@ -53,9 +53,8 @@ public class UserConnection { } /** - * - * @see #UserConnection(Channel, boolean) * @param channel + * @see #UserConnection(Channel, boolean) */ public UserConnection(@Nullable Channel channel) { this(channel, false); @@ -142,8 +141,7 @@ public class UserConnection { } private ChannelFuture sendRawPacketFutureServerSide(final ByteBuf packet) { - final ChannelHandler handler = channel.pipeline().get(Via.getManager().getInjector().getEncoderName()); - return channel.pipeline().context(handler).writeAndFlush(packet); + return channel.pipeline().context(Via.getManager().getInjector().getEncoderName()).writeAndFlush(packet); } private ChannelFuture sendRawPacketFutureClientSide(final ByteBuf packet) { diff --git a/velocity/src/main/java/us/myles/ViaVersion/velocity/platform/VelocityViaLoader.java b/velocity/src/main/java/us/myles/ViaVersion/velocity/platform/VelocityViaLoader.java index e5dab0702..2d635fa7c 100644 --- a/velocity/src/main/java/us/myles/ViaVersion/velocity/platform/VelocityViaLoader.java +++ b/velocity/src/main/java/us/myles/ViaVersion/velocity/platform/VelocityViaLoader.java @@ -24,7 +24,6 @@ public class VelocityViaLoader implements ViaPlatformLoader { if (ProtocolRegistry.SERVER_PROTOCOL < ProtocolVersion.v1_9.getVersion()) { Via.getManager().getProviders().use(MovementTransmitterProvider.class, new VelocityMovementTransmitter()); Via.getManager().getProviders().use(BossBarProvider.class, new VelocityBossBarProvider()); - //VelocityPlugin.PROXY.getEventManager().register(plugin, new ElytraPatch()); } Via.getManager().getProviders().use(VersionProvider.class, new VelocityVersionProvider()); @@ -32,7 +31,6 @@ public class VelocityViaLoader implements ViaPlatformLoader { // We don't need main hand patch because Join Game packet makes client send hand data again VelocityPlugin.PROXY.getEventManager().register(plugin, new UpdateListener()); - //VelocityPlugin.PROXY.getEventManager().register(plugin, new VelocityServerHandler()); int pingInterval = ((VelocityViaConfig) Via.getPlatform().getConf()).getVelocityPingInterval(); if (pingInterval > 0) {