diff --git a/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java b/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java index 4c1965b5..6ef00b28 100644 --- a/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java +++ b/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java @@ -85,4 +85,18 @@ public interface ProxiedPlayer extends Connection, CommandSender * @return the tab list in use by this user */ TabListHandler getTabList(); + + /** + * Get the server which this player will be sent to next time the log in. + * + * @return the server, or null if default + */ + ServerInfo getReconnectServer(); + + /** + * Set the server which this player will be sent to next time the log in. + * + * @param server the server to set + */ + void setReconnectServer(ServerInfo server); } diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java index 172f435b..b1685647 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -73,6 +73,9 @@ public final class UserConnection implements ProxiedPlayer @Getter @Setter private int ping = 100; + @Getter + @Setter + private ServerInfo reconnectServer; /*========================================================================*/ private final Collection groups = new CaseInsensitiveSet(); private final Collection permissions = new CaseInsensitiveSet(); diff --git a/proxy/src/main/java/net/md_5/bungee/reconnect/YamlReconnectHandler.java b/proxy/src/main/java/net/md_5/bungee/reconnect/YamlReconnectHandler.java index c23de851..2c7a219b 100644 --- a/proxy/src/main/java/net/md_5/bungee/reconnect/YamlReconnectHandler.java +++ b/proxy/src/main/java/net/md_5/bungee/reconnect/YamlReconnectHandler.java @@ -71,7 +71,7 @@ public class YamlReconnectHandler extends AbstractReconnectManager lock.writeLock().lock(); try { - data.put( key( player ), player.getServer().getInfo().getName() ); + data.put( key( player ), ( player.getReconnectServer() != null ) ? player.getReconnectServer().getName() : player.getServer().getInfo().getName() ); } finally { lock.writeLock().unlock();