@Override public String getServer(ProxiedPlayer player) { ListenerInfo listener = player.getPendingConnection().getListener(); if (listener.isForceDefault()) { return listener.getDefaultServer(); } String forced = listener.getForcedHosts().get(player.getPendingConnection().getVirtualHost().getHostName()); String server = (forced == null) ? data.get(key(player)) : forced; return (server != null) ? server : listener.getDefaultServer(); }
private String key(ProxiedPlayer player) { InetSocketAddress host = player.getPendingConnection().getVirtualHost(); return player.getName() + ";" + host.getHostString() + ":" + host.getPort(); }