Update Server interface to remove depreceated methods
This commit is contained in:
parent
0afc52c130
commit
0f9cc76633
@ -24,14 +24,4 @@ public interface Server extends Connection
|
|||||||
* @param data the data to send
|
* @param data the data to send
|
||||||
*/
|
*/
|
||||||
public abstract void sendData(String channel, byte[] data);
|
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<ServerPing> callback);
|
|
||||||
}
|
}
|
||||||
|
@ -1,47 +1,28 @@
|
|||||||
package net.md_5.bungee;
|
package net.md_5.bungee;
|
||||||
|
|
||||||
|
import io.netty.channel.Channel;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.Socket;
|
|
||||||
import java.util.Queue;
|
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.md_5.bungee.api.Callback;
|
import lombok.RequiredArgsConstructor;
|
||||||
import net.md_5.bungee.api.ServerPing;
|
|
||||||
import net.md_5.bungee.api.config.ServerInfo;
|
import net.md_5.bungee.api.config.ServerInfo;
|
||||||
import net.md_5.bungee.api.connection.Server;
|
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.Packet1Login;
|
||||||
import net.md_5.bungee.packet.PacketFAPluginMessage;
|
import net.md_5.bungee.packet.PacketFAPluginMessage;
|
||||||
import net.md_5.bungee.packet.PacketStream;
|
|
||||||
|
|
||||||
/**
|
@RequiredArgsConstructor
|
||||||
* Class representing a connection from the proxy to the server; ie upstream.
|
public class ServerConnection implements Server
|
||||||
*/
|
|
||||||
public class ServerConnection extends GenericConnection implements Server
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private final Channel ch;
|
||||||
@Getter
|
@Getter
|
||||||
private final ServerInfo info;
|
private final ServerInfo info;
|
||||||
public final Packet1Login loginPacket;
|
@Getter
|
||||||
public Queue<DefinedPacket> packetQueue = new ConcurrentLinkedQueue<>();
|
private final Packet1Login loginPacket;
|
||||||
|
|
||||||
public ServerConnection(Socket socket, ServerInfo info, PacketStream stream, Packet1Login loginPacket)
|
|
||||||
{
|
|
||||||
super( socket, stream );
|
|
||||||
this.info = info;
|
|
||||||
this.loginPacket = loginPacket;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendData(String channel, byte[] data)
|
public void sendData(String channel, byte[] data)
|
||||||
{
|
{
|
||||||
packetQueue.add( new PacketFAPluginMessage( channel, data ) );
|
ch.write( new PacketFAPluginMessage( channel, data ) );
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void ping(final Callback<ServerPing> callback)
|
|
||||||
{
|
|
||||||
getInfo().ping( callback );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user