code cleanup

This commit is contained in:
creeper123123321 2020-08-05 06:20:13 -03:00 committed by Five (Xer)
parent 0343be6915
commit 72f8052e58
No known key found for this signature in database
GPG Key ID: A3F306B10E6330E7
2 changed files with 6 additions and 10 deletions

View File

@ -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<Class, StoredObject> storedObjects = new ConcurrentHashMap<>();
private final boolean clientSide;
Map<Class, StoredObject> 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) {

View File

@ -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) {