Use Channel instead of SocketChannel

For better compatibility with third party software.
This commit is contained in:
Myles 2018-09-23 18:52:26 +01:00
parent 6457ff315f
commit 85ab5d7741

View File

@ -1,10 +1,10 @@
package us.myles.ViaVersion.api.data; 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.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.socket.SocketChannel;
import lombok.Data; import lombok.Data;
import lombok.NonNull; import lombok.NonNull;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
@ -21,14 +21,8 @@ import java.util.concurrent.ConcurrentHashMap;
@Data @Data
public class UserConnection { public class UserConnection {
/**
* The channel of the user.
* /!\ In some unofficial platforms this is a client channel
*
* TODO - Weak this field to {@link io.netty.channel.Channel}?
*/
@NonNull @NonNull
private final SocketChannel channel; private final Channel channel;
Map<Class, StoredObject> storedObjects = new ConcurrentHashMap<>(); Map<Class, StoredObject> storedObjects = new ConcurrentHashMap<>();
private boolean active = true; private boolean active = true;
private boolean pendingDisconnect = false; private boolean pendingDisconnect = false;
@ -44,8 +38,8 @@ public class UserConnection {
private int warnings = 0; private int warnings = 0;
public UserConnection(SocketChannel socketChannel) { public UserConnection(Channel channel) {
this.channel = socketChannel; this.channel = channel;
} }
/** /**