From 3e28decef26a5894b072aa6ae487b38aeda6540c Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 25 May 2013 17:09:29 +1000 Subject: [PATCH] Remove getServer from the api - long depreceated --- .../main/java/net/md_5/bungee/api/ProxyServer.java | 14 -------------- .../src/main/java/net/md_5/bungee/BungeeCord.java | 7 ------- .../java/net/md_5/bungee/BungeeServerInfo.java | 3 ++- 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/api/src/main/java/net/md_5/bungee/api/ProxyServer.java b/api/src/main/java/net/md_5/bungee/api/ProxyServer.java index 09902527..9652efd5 100644 --- a/api/src/main/java/net/md_5/bungee/api/ProxyServer.java +++ b/api/src/main/java/net/md_5/bungee/api/ProxyServer.java @@ -79,20 +79,6 @@ public abstract class ProxyServer */ public abstract ProxiedPlayer getPlayer(String name); - /** - * Get a server by its name. The instance returned will be taken from a - * player currently on that server to facilitate abstract proxy -> server - * actions. - * - * @param name the name to lookup - * @return the associated server - * @deprecated in most cases the {@link #getServerInfo(java.lang.String)} - * method should be used, as it will return a server even when no players - * are online. - */ - @Deprecated - public abstract Server getServer(String name); - /** * Return all servers registered to this proxy, keyed by name. Unlike the * methods in {@link ConfigurationAdapter#getServers()}, this will not diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java index 07a45a9d..e59e9301 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java @@ -391,13 +391,6 @@ public class BungeeCord extends ProxyServer } } - @Override - public Server getServer(String name) - { - Collection users = getServers().get( name ).getPlayers(); - return ( users != null && !users.isEmpty() ) ? users.iterator().next().getServer() : null; - } - @Override public Map getServers() { diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java b/proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java index 097e6f0d..7490bdef 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java @@ -79,10 +79,11 @@ public class BungeeServerInfo implements ServerInfo return address.hashCode(); } + // TODO: Don't like this method @Override public void sendData(String channel, byte[] data) { - Server server = ProxyServer.getInstance().getServer( getName() ); + Server server = ( players.isEmpty() ) ? null : players.iterator().next().getServer(); if ( server != null ) { server.sendData( channel, data );