mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-24 03:05:49 +01:00
Use correct disconnect sequence at all times, fixes #119 and events not firing at stop
This commit is contained in:
parent
c44dc7931a
commit
297c8e2c8b
@ -154,22 +154,24 @@ public class UserConnection extends GenericConnection implements ProxiedPlayer
|
||||
downBridge.start();
|
||||
} catch ( KickException ex )
|
||||
{
|
||||
destroySelf( ex.getMessage() );
|
||||
disconnect( ex.getMessage() );
|
||||
} catch ( Exception ex )
|
||||
{
|
||||
destroySelf( "Could not connect to server - " + Util.exception( ex ) );
|
||||
disconnect( "Could not connect to server - " + Util.exception( ex ) );
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void destroySelf(String reason)
|
||||
@Override
|
||||
public void disconnect(String reason)
|
||||
{
|
||||
if ( clientConnected )
|
||||
{
|
||||
PlayerDisconnectEvent event = new PlayerDisconnectEvent( this );
|
||||
ProxyServer.getInstance().getPluginManager().callEvent( event );
|
||||
ProxyServer.getInstance().getTabListHandler().onDisconnect( this );
|
||||
ProxyServer.getInstance().getPlayers().remove( this );
|
||||
|
||||
disconnect( reason );
|
||||
super.disconnect( reason );
|
||||
if ( server != null )
|
||||
{
|
||||
server.getInfo().removePlayer( this );
|
||||
@ -181,13 +183,6 @@ public class UserConnection extends GenericConnection implements ProxiedPlayer
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnect(String reason)
|
||||
{
|
||||
ProxyServer.getInstance().getTabListHandler().onDisconnect( this );
|
||||
super.disconnect( reason );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
@ -340,10 +335,10 @@ public class UserConnection extends GenericConnection implements ProxiedPlayer
|
||||
}
|
||||
} catch ( IOException ex )
|
||||
{
|
||||
destroySelf( "Reached end of stream" );
|
||||
disconnect( "Reached end of stream" );
|
||||
} catch ( Exception ex )
|
||||
{
|
||||
destroySelf( Util.exception( ex ) );
|
||||
disconnect( Util.exception( ex ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -543,7 +538,7 @@ public class UserConnection extends GenericConnection implements ProxiedPlayer
|
||||
}
|
||||
} catch ( Exception ex )
|
||||
{
|
||||
destroySelf( Util.exception( ex ) );
|
||||
disconnect( Util.exception( ex ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user