diff --git a/api/src/main/java/net/md_5/bungee/api/connection/Server.java b/api/src/main/java/net/md_5/bungee/api/connection/Server.java index f94e5a966..58ae7a1fc 100644 --- a/api/src/main/java/net/md_5/bungee/api/connection/Server.java +++ b/api/src/main/java/net/md_5/bungee/api/connection/Server.java @@ -24,14 +24,4 @@ public interface Server extends Connection * @param data the data to send */ public abstract void sendData(String channel, byte[] data); - - /** - * Asynchronously gets the current player count on this server. - * - * @param callback the callback to call when the count has been retrieved. - * @deprecated use the corresponding method in {@link ServerInfo} for - * clarity - */ - @Deprecated - public abstract void ping(Callback callback); } diff --git a/proxy/src/main/java/net/md_5/bungee/ServerConnection.java b/proxy/src/main/java/net/md_5/bungee/ServerConnection.java index 62fc35072..6e6e01445 100644 --- a/proxy/src/main/java/net/md_5/bungee/ServerConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/ServerConnection.java @@ -1,47 +1,28 @@ package net.md_5.bungee; +import io.netty.channel.Channel; import java.net.InetSocketAddress; -import java.net.Socket; -import java.util.Queue; -import java.util.concurrent.ConcurrentLinkedQueue; import lombok.Getter; -import net.md_5.bungee.api.Callback; -import net.md_5.bungee.api.ServerPing; +import lombok.RequiredArgsConstructor; import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.connection.Server; -import net.md_5.bungee.packet.DefinedPacket; import net.md_5.bungee.packet.Packet1Login; import net.md_5.bungee.packet.PacketFAPluginMessage; -import net.md_5.bungee.packet.PacketStream; -/** - * Class representing a connection from the proxy to the server; ie upstream. - */ -public class ServerConnection extends GenericConnection implements Server +@RequiredArgsConstructor +public class ServerConnection implements Server { + private final Channel ch; @Getter private final ServerInfo info; - public final Packet1Login loginPacket; - public Queue packetQueue = new ConcurrentLinkedQueue<>(); - - public ServerConnection(Socket socket, ServerInfo info, PacketStream stream, Packet1Login loginPacket) - { - super( socket, stream ); - this.info = info; - this.loginPacket = loginPacket; - } + @Getter + private final Packet1Login loginPacket; @Override public void sendData(String channel, byte[] data) { - packetQueue.add( new PacketFAPluginMessage( channel, data ) ); - } - - @Override - public void ping(final Callback callback) - { - getInfo().ping( callback ); + ch.write( new PacketFAPluginMessage( channel, data ) ); } @Override