Add API to support #468 - force setting of reconnect server

This commit is contained in:
md_5 2013-09-15 07:12:58 +10:00
parent 47b5631562
commit 702f434db1
3 changed files with 18 additions and 1 deletions

View File

@ -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);
}

View File

@ -73,6 +73,9 @@ public final class UserConnection implements ProxiedPlayer
@Getter
@Setter
private int ping = 100;
@Getter
@Setter
private ServerInfo reconnectServer;
/*========================================================================*/
private final Collection<String> groups = new CaseInsensitiveSet();
private final Collection<String> permissions = new CaseInsensitiveSet();

View File

@ -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();