Replace default/fallback servers with a server priority list.

This commit is contained in:
md_5
2016-03-01 09:13:11 +11:00
parent 7d2c2ab074
commit 219819b738
2 changed files with 86 additions and 10 deletions

View File

@@ -1,8 +1,11 @@
package net.md_5.bungee.api.config;
import java.net.InetSocketAddress;
import java.util.List;
import java.util.Map;
import lombok.AccessLevel;
import lombok.Data;
import lombok.Getter;
/**
* Class representing the configuration of a server listener. Used for allowing
@@ -29,14 +32,10 @@ public class ListenerInfo
*/
private final int tabListSize;
/**
* Name of the server which users will be taken to by default.
* List of servers in order of join attempt. First attempt is the first
* element, second attempt is the next element, etc etc.
*/
private final String defaultServer;
/**
* Name of the server which users will be taken when current server goes
* down.
*/
private final String fallbackServer;
private final List<String> serverPriority;
/**
* Whether reconnect locations will be used, or else the user is simply
* transferred to the default server on connect.
@@ -68,4 +67,29 @@ public class ListenerInfo
* Whether to enable udp query.
*/
private final boolean queryEnabled;
/**
* Gets the highest priority server to join.
*
* @return default server
* @deprecated replaced by {@link #serverPriority}
*/
@Deprecated
public String getDefaultServer()
{
return serverPriority.get( 0 );
}
/**
* Gets the second highest priority server to join, or else the highest
* priority.
*
* @return fallback server
* @deprecated replaced by {@link #serverPriority}
*/
@Deprecated
public String getFallbackServer()
{
return ( serverPriority.size() > 1 ) ? serverPriority.get( 1 ) : getDefaultServer();
}
}