Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-27 08:30:09 +01:00
code cleanup
Dieser Commit ist enthalten in:
Ursprung
0343be6915
Commit
72f8052e58
@ -3,7 +3,6 @@ package us.myles.ViaVersion.api.data;
|
|||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelHandler;
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@ -26,9 +25,9 @@ public class UserConnection {
|
|||||||
private static final AtomicLong IDS = new AtomicLong();
|
private static final AtomicLong IDS = new AtomicLong();
|
||||||
private final long id = IDS.incrementAndGet();
|
private final long id = IDS.incrementAndGet();
|
||||||
private final Channel channel;
|
private final Channel channel;
|
||||||
private ProtocolInfo protocolInfo;
|
|
||||||
Map<Class, StoredObject> storedObjects = new ConcurrentHashMap<>();
|
|
||||||
private final boolean clientSide;
|
private final boolean clientSide;
|
||||||
|
Map<Class, StoredObject> storedObjects = new ConcurrentHashMap<>();
|
||||||
|
private ProtocolInfo protocolInfo;
|
||||||
private boolean active = true;
|
private boolean active = true;
|
||||||
private boolean pendingDisconnect;
|
private boolean pendingDisconnect;
|
||||||
private Object lastPacket;
|
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.
|
* 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
|
* @param clientSide true if it's a client-side connection
|
||||||
*/
|
*/
|
||||||
public UserConnection(@Nullable Channel channel, boolean clientSide) {
|
public UserConnection(@Nullable Channel channel, boolean clientSide) {
|
||||||
@ -53,9 +53,8 @@ public class UserConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see #UserConnection(Channel, boolean)
|
|
||||||
* @param channel
|
* @param channel
|
||||||
|
* @see #UserConnection(Channel, boolean)
|
||||||
*/
|
*/
|
||||||
public UserConnection(@Nullable Channel channel) {
|
public UserConnection(@Nullable Channel channel) {
|
||||||
this(channel, false);
|
this(channel, false);
|
||||||
@ -142,8 +141,7 @@ public class UserConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ChannelFuture sendRawPacketFutureServerSide(final ByteBuf packet) {
|
private ChannelFuture sendRawPacketFutureServerSide(final ByteBuf packet) {
|
||||||
final ChannelHandler handler = channel.pipeline().get(Via.getManager().getInjector().getEncoderName());
|
return channel.pipeline().context(Via.getManager().getInjector().getEncoderName()).writeAndFlush(packet);
|
||||||
return channel.pipeline().context(handler).writeAndFlush(packet);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ChannelFuture sendRawPacketFutureClientSide(final ByteBuf packet) {
|
private ChannelFuture sendRawPacketFutureClientSide(final ByteBuf packet) {
|
||||||
|
@ -24,7 +24,6 @@ public class VelocityViaLoader implements ViaPlatformLoader {
|
|||||||
if (ProtocolRegistry.SERVER_PROTOCOL < ProtocolVersion.v1_9.getVersion()) {
|
if (ProtocolRegistry.SERVER_PROTOCOL < ProtocolVersion.v1_9.getVersion()) {
|
||||||
Via.getManager().getProviders().use(MovementTransmitterProvider.class, new VelocityMovementTransmitter());
|
Via.getManager().getProviders().use(MovementTransmitterProvider.class, new VelocityMovementTransmitter());
|
||||||
Via.getManager().getProviders().use(BossBarProvider.class, new VelocityBossBarProvider());
|
Via.getManager().getProviders().use(BossBarProvider.class, new VelocityBossBarProvider());
|
||||||
//VelocityPlugin.PROXY.getEventManager().register(plugin, new ElytraPatch());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Via.getManager().getProviders().use(VersionProvider.class, new VelocityVersionProvider());
|
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
|
// 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 UpdateListener());
|
||||||
//VelocityPlugin.PROXY.getEventManager().register(plugin, new VelocityServerHandler());
|
|
||||||
|
|
||||||
int pingInterval = ((VelocityViaConfig) Via.getPlatform().getConf()).getVelocityPingInterval();
|
int pingInterval = ((VelocityViaConfig) Via.getPlatform().getConf()).getVelocityPingInterval();
|
||||||
if (pingInterval > 0) {
|
if (pingInterval > 0) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren