#3129: Replace ConnectTimeoutException with a more user-friendly string.
This commit is contained in:
parent
cb738188de
commit
f9583a7652
@ -8,6 +8,7 @@ import io.netty.channel.ChannelFuture;
|
|||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
|
import io.netty.channel.ConnectTimeoutException;
|
||||||
import io.netty.util.internal.PlatformDependent;
|
import io.netty.util.internal.PlatformDependent;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
@ -351,10 +352,10 @@ public final class UserConnection implements ProxiedPlayer
|
|||||||
connect( def, null, true, ServerConnectEvent.Reason.LOBBY_FALLBACK );
|
connect( def, null, true, ServerConnectEvent.Reason.LOBBY_FALLBACK );
|
||||||
} else if ( dimensionChange )
|
} else if ( dimensionChange )
|
||||||
{
|
{
|
||||||
disconnect( bungee.getTranslation( "fallback_kick", future.cause().getClass().getName() ) );
|
disconnect( bungee.getTranslation( "fallback_kick", connectionFailMessage( future.cause() ) ) );
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
sendMessage( bungee.getTranslation( "fallback_kick", future.cause().getClass().getName() ) );
|
sendMessage( bungee.getTranslation( "fallback_kick", connectionFailMessage( future.cause() ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -373,6 +374,17 @@ public final class UserConnection implements ProxiedPlayer
|
|||||||
b.connect().addListener( listener );
|
b.connect().addListener( listener );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String connectionFailMessage(Throwable cause)
|
||||||
|
{
|
||||||
|
if ( cause instanceof ConnectTimeoutException )
|
||||||
|
{
|
||||||
|
return bungee.getTranslation( "timeout" );
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return cause.getClass().getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnect(String reason)
|
public void disconnect(String reason)
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,7 @@ connect_kick=\u00a7cKicked whilst connecting to {0}: {1}
|
|||||||
current_server=\u00a76You are currently connected to {0}.
|
current_server=\u00a76You are currently connected to {0}.
|
||||||
fallback_kick=\u00a7cCould not connect to a default or fallback server, please try again later: {0}
|
fallback_kick=\u00a7cCould not connect to a default or fallback server, please try again later: {0}
|
||||||
fallback_lobby=\u00a7cCould not connect to target server, you have been moved to a fallback server.
|
fallback_lobby=\u00a7cCould not connect to target server, you have been moved to a fallback server.
|
||||||
|
timeout=Server not reachable (timeout). Offline? Incorrectly configured address/port/firewall?
|
||||||
lost_connection=[Proxy] Lost connection to server.
|
lost_connection=[Proxy] Lost connection to server.
|
||||||
mojang_fail=Error occurred while contacting login servers, are they down?
|
mojang_fail=Error occurred while contacting login servers, are they down?
|
||||||
no_permission=\u00a7cYou do not have permission to execute this command!
|
no_permission=\u00a7cYou do not have permission to execute this command!
|
||||||
|
Loading…
Reference in New Issue
Block a user