mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-24 03:05:49 +01:00
#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.ChannelInitializer;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.ConnectTimeoutException;
|
||||
import io.netty.util.internal.PlatformDependent;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
@ -351,10 +352,10 @@ public final class UserConnection implements ProxiedPlayer
|
||||
connect( def, null, true, ServerConnectEvent.Reason.LOBBY_FALLBACK );
|
||||
} else if ( dimensionChange )
|
||||
{
|
||||
disconnect( bungee.getTranslation( "fallback_kick", future.cause().getClass().getName() ) );
|
||||
disconnect( bungee.getTranslation( "fallback_kick", connectionFailMessage( future.cause() ) ) );
|
||||
} 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 );
|
||||
}
|
||||
|
||||
private String connectionFailMessage(Throwable cause)
|
||||
{
|
||||
if ( cause instanceof ConnectTimeoutException )
|
||||
{
|
||||
return bungee.getTranslation( "timeout" );
|
||||
} else
|
||||
{
|
||||
return cause.getClass().getName();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
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}.
|
||||
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.
|
||||
timeout=Server not reachable (timeout). Offline? Incorrectly configured address/port/firewall?
|
||||
lost_connection=[Proxy] Lost connection to server.
|
||||
mojang_fail=Error occurred while contacting login servers, are they down?
|
||||
no_permission=\u00a7cYou do not have permission to execute this command!
|
||||
|
Loading…
Reference in New Issue
Block a user