@Override public void exception(Throwable t) throws Exception { con.disconnect( Util.exception( t ) ); }
@Override public void exception(Throwable t) throws Exception { if ( obsolete ) { return; } String message = "Exception Connecting:" + Util.exception( t ); if ( user.getServer() == null ) { user.disconnect( message ); } else { user.sendMessage( ChatColor.RED + message ); } }
@Override @SuppressWarnings("ThrowableResultIgnored") public void operationComplete(ChannelFuture future) throws Exception { if ( callback != null ) { callback.done( ( future.isSuccess() ) ? ServerConnectRequest.Result.SUCCESS : ServerConnectRequest.Result.FAIL, future.cause() ); } if ( !future.isSuccess() ) { future.channel().close(); pendingConnects.remove( target ); ServerInfo def = updateAndGetNextServer( target ); if ( request.isRetry() && def != null && ( getServer() == null || def != getServer().getInfo() ) ) { sendMessage( bungee.getTranslation( "fallback_lobby" ) ); connect( def, null, true, ServerConnectEvent.Reason.LOBBY_FALLBACK ); } else if ( dimensionChange ) { disconnect( bungee.getTranslation( "fallback_kick", future.cause().getClass().getName() ) ); } else { sendMessage( bungee.getTranslation( "fallback_kick", future.cause().getClass().getName() ) ); } } } };
for ( UserConnection user : connections.values() ) user.disconnect( reason );
@Override public void exception(Throwable t) throws Exception { if ( server.isObsolete() ) { // do not perform any actions if the user has already moved return; } ServerInfo def = con.updateAndGetNextServer( server.getInfo() ); if ( def != null ) { server.setObsolete( true ); con.connectNow( def, ServerConnectEvent.Reason.SERVER_DOWN_REDIRECT ); con.sendMessage( bungee.getTranslation( "server_went_down" ) ); } else { con.disconnect( Util.exception( t ) ); } }
@Override public void disconnected(ChannelWrapper channel) throws Exception { // We lost connection to the server server.getInfo().removePlayer( con ); if ( bungee.getReconnectHandler() != null ) { bungee.getReconnectHandler().setServer( con ); } if ( !server.isObsolete() ) { con.disconnect( bungee.getTranslation( "lost_connection" ) ); } ServerDisconnectEvent serverDisconnectEvent = new ServerDisconnectEvent( con, server.getInfo() ); bungee.getPluginManager().callEvent( serverDisconnectEvent ); }
@Override public void handle(Kick kick) throws Exception { ServerInfo def = user.updateAndGetNextServer( target ); ServerKickEvent event = new ServerKickEvent( user, target, ComponentSerializer.parse( kick.getMessage() ), def, ServerKickEvent.State.CONNECTING ); if ( event.getKickReason().toLowerCase( Locale.ROOT ).contains( "outdated" ) && def != null ) { // Pre cancel the event if we are going to try another server event.setCancelled( true ); } bungee.getPluginManager().callEvent( event ); if ( event.isCancelled() && event.getCancelServer() != null ) { obsolete = true; user.connect( event.getCancelServer(), ServerConnectEvent.Reason.KICK_REDIRECT ); throw CancelSendSignal.INSTANCE; } String message = bungee.getTranslation( "connect_kick", target.getName(), event.getKickReason() ); if ( user.isDimensionChange() ) { user.disconnect( message ); } else { user.sendMessage( message ); } throw CancelSendSignal.INSTANCE; }
@Override public void exception(Throwable t) throws Exception { con.disconnect( Util.exception( t ) ); }
/** * Checks to see if a user is using an outdated FML build, and takes * appropriate action on the User side. This should only be called during a * server connection, by the ServerConnector * * @return <code>true</code> if the user's FML build is outdated, otherwise * <code>false</code> */ public boolean checkUserOutdated() { if (forgeOutdated) { con.disconnect(BungeeCord.getInstance().getTranslation("connect_kick_outdated_forge")); } return forgeOutdated; } }
@Override public void exception(Throwable t) throws Exception { if ( obsolete ) { return; } String message = "Exception Connecting:" + Util.exception( t ); if ( user.getServer() == null ) { user.disconnect( message ); } else { user.sendMessage( ChatColor.RED + message ); } }
@Override @SuppressWarnings("ThrowableResultIgnored") public void operationComplete(ChannelFuture future) throws Exception { if ( callback != null ) { callback.done( future.isSuccess(), future.cause() ); } if ( !future.isSuccess() ) { future.channel().close(); pendingConnects.remove( target ); ServerInfo def = updateAndGetNextServer( target ); if ( retry && def != null && ( getServer() == null || def != getServer().getInfo() ) ) { sendMessage( bungee.getTranslation( "fallback_lobby" ) ); connect( def, null, false, timeout ); } else if ( dimensionChange ) { disconnect( bungee.getTranslation( "fallback_kick", future.cause().getClass().getName() ) ); } else { sendMessage( bungee.getTranslation( "fallback_kick", future.cause().getClass().getName() ) ); } } } };
for ( UserConnection user : connections.values() ) user.disconnect( reason );
@Override public void disconnected(ChannelWrapper channel) throws Exception { // We lost connection to the server server.getInfo().removePlayer( con ); if ( bungee.getReconnectHandler() != null ) { bungee.getReconnectHandler().setServer( con ); } if ( !server.isObsolete() ) { con.disconnect( bungee.getTranslation( "lost_connection" ) ); } ServerDisconnectEvent serverDisconnectEvent = new ServerDisconnectEvent( con, server.getInfo() ); bungee.getPluginManager().callEvent( serverDisconnectEvent ); }
@Override public void handle(Kick kick) throws Exception { ServerInfo def = user.updateAndGetNextServer( target ); ServerKickEvent event = new ServerKickEvent( user, target, ComponentSerializer.parse( kick.getMessage() ), def, ServerKickEvent.State.CONNECTING ); if ( event.getKickReason().toLowerCase().contains( "outdated" ) && def != null ) { // Pre cancel the event if we are going to try another server event.setCancelled( true ); } bungee.getPluginManager().callEvent( event ); if ( event.isCancelled() && event.getCancelServer() != null ) { obsolete = true; user.connect( event.getCancelServer() ); throw CancelSendSignal.INSTANCE; } String message = bungee.getTranslation( "connect_kick", target.getName(), event.getKickReason() ); if ( user.isDimensionChange() ) { user.disconnect( message ); } else { user.sendMessage( message ); } throw CancelSendSignal.INSTANCE; }
@Override public void exception(Throwable t) throws Exception { if ( server.isObsolete() ) { // do not perform any actions if the user has already moved return; } ServerInfo def = bungee.getServerInfo( con.getPendingConnection().getListener().getFallbackServer() ); if ( server.getInfo() != def ) { server.setObsolete( true ); con.connectNow( def ); con.sendMessage( bungee.getTranslation( "server_went_down" ) ); } else { con.disconnect( Util.exception( t ) ); } }