add fallback_server so we can still have a different default server on first join
This commit is contained in:
parent
fecaf76acf
commit
5dfe83cf6d
@ -32,6 +32,10 @@ public class ListenerInfo
|
|||||||
* Name of the server which users will be taken to by default.
|
* Name of the server which users will be taken to by default.
|
||||||
*/
|
*/
|
||||||
private final String defaultServer;
|
private final String defaultServer;
|
||||||
|
/**
|
||||||
|
* Name of the server which users will be taken when current server goes down.
|
||||||
|
*/
|
||||||
|
private final String fallbackServer;
|
||||||
/**
|
/**
|
||||||
* Whether reconnect locations will be used, or else the user is simply
|
* Whether reconnect locations will be used, or else the user is simply
|
||||||
* transferred to the default server on connect.
|
* transferred to the default server on connect.
|
||||||
|
@ -164,7 +164,7 @@ public class ServerConnector extends PacketHandler
|
|||||||
@Override
|
@Override
|
||||||
public void handle(PacketFFKick kick) throws Exception
|
public void handle(PacketFFKick kick) throws Exception
|
||||||
{
|
{
|
||||||
ServerInfo def = bungee.getServerInfo( user.getPendingConnection().getListener().getDefaultServer() );
|
ServerInfo def = bungee.getServerInfo( user.getPendingConnection().getListener().getFallbackServer() );
|
||||||
if ( target == def )
|
if ( target == def )
|
||||||
{
|
{
|
||||||
def = null;
|
def = null;
|
||||||
|
@ -148,10 +148,10 @@ public final class UserConnection implements ProxiedPlayer
|
|||||||
if ( !future.isSuccess() )
|
if ( !future.isSuccess() )
|
||||||
{
|
{
|
||||||
future.channel().close();
|
future.channel().close();
|
||||||
ServerInfo def = ProxyServer.getInstance().getServers().get( getPendingConnection().getListener().getDefaultServer() );
|
ServerInfo def = ProxyServer.getInstance().getServers().get( getPendingConnection().getListener().getFallbackServer() );
|
||||||
if ( retry & target != def && ( getServer() == null || def != getServer().getInfo() ) )
|
if ( retry & target != def && ( getServer() == null || def != getServer().getInfo() ) )
|
||||||
{
|
{
|
||||||
sendMessage( ChatColor.RED + "Could not connect to target server, you have been moved to the default server" );
|
sendMessage( ChatColor.RED + "Could not connect to target server, you have been moved to the lobby server" );
|
||||||
connect( def, false );
|
connect( def, false );
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
@ -181,6 +181,7 @@ public class YamlConfig implements ConfigurationAdapter
|
|||||||
|
|
||||||
int maxPlayers = get( "max_players", 1, val );
|
int maxPlayers = get( "max_players", 1, val );
|
||||||
String defaultServer = get( "default_server", "lobby", val );
|
String defaultServer = get( "default_server", "lobby", val );
|
||||||
|
String fallbackServer = get( "fallback_server", defaultServer, val );
|
||||||
boolean forceDefault = get( "force_default_server", false, val );
|
boolean forceDefault = get( "force_default_server", false, val );
|
||||||
String host = get( "host", "0.0.0.0:25577", val );
|
String host = get( "host", "0.0.0.0:25577", val );
|
||||||
int tabListSize = get( "tab_size", 60, val );
|
int tabListSize = get( "tab_size", 60, val );
|
||||||
@ -189,7 +190,7 @@ public class YamlConfig implements ConfigurationAdapter
|
|||||||
String textureURL = get( "texture_url", null, val );
|
String textureURL = get( "texture_url", null, val );
|
||||||
int textureSize = get( "texture_size", 16, val );
|
int textureSize = get( "texture_size", 16, val );
|
||||||
TexturePackInfo texture = ( textureURL == null ) ? null : new TexturePackInfo( textureURL, textureSize );
|
TexturePackInfo texture = ( textureURL == null ) ? null : new TexturePackInfo( textureURL, textureSize );
|
||||||
ListenerInfo info = new ListenerInfo( address, motd, maxPlayers, tabListSize, defaultServer, forceDefault, forced, texture );
|
ListenerInfo info = new ListenerInfo( address, motd, maxPlayers, tabListSize, defaultServer, fallbackServer, forceDefault, forced, texture );
|
||||||
ret.add( info );
|
ret.add( info );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public class DownstreamBridge extends PacketHandler
|
|||||||
@Override
|
@Override
|
||||||
public void exception(Throwable t) throws Exception
|
public void exception(Throwable t) throws Exception
|
||||||
{
|
{
|
||||||
ServerInfo def = bungee.getServerInfo( con.getPendingConnection().getListener().getDefaultServer() );
|
ServerInfo def = bungee.getServerInfo( con.getPendingConnection().getListener().getFallbackServer() );
|
||||||
if ( server.getInfo() != def )
|
if ( server.getInfo() != def )
|
||||||
{
|
{
|
||||||
con.connectNow( def );
|
con.connectNow( def );
|
||||||
@ -313,7 +313,7 @@ public class DownstreamBridge extends PacketHandler
|
|||||||
@Override
|
@Override
|
||||||
public void handle(PacketFFKick kick) throws Exception
|
public void handle(PacketFFKick kick) throws Exception
|
||||||
{
|
{
|
||||||
ServerInfo def = bungee.getServerInfo( con.getPendingConnection().getListener().getDefaultServer() );
|
ServerInfo def = bungee.getServerInfo( con.getPendingConnection().getListener().getFallbackServer() );
|
||||||
if ( server.getInfo() == def )
|
if ( server.getInfo() == def )
|
||||||
{
|
{
|
||||||
def = null;
|
def = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user