Skip to content

Commit

Permalink
print disconnect message of InitialHandlers
Browse files Browse the repository at this point in the history
  • Loading branch information
Outfluencer authored Dec 20, 2023
1 parent 8537709 commit 46fddc4
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,22 @@ public void channelInactive(ChannelHandlerContext ctx) throws Exception
channel.markClosed();
handler.disconnected( channel );

if ( !( handler instanceof InitialHandler || handler instanceof PingHandler ) )
if ( !( handler instanceof PingHandler ) )
{
ProxyServer.getInstance().getLogger().log( Level.INFO, "{0} has disconnected", handler );
if ( handler instanceof InitialHandler )
{
InitialHandler initialHandler = (InitialHandler) handler;
if ( initialHandler.getDisconnectMessage() != null )
{
ProxyServer.getInstance().getLogger().log( Level.INFO, "{0} has disconnected: {1}", new Object[]
{
handler, initialHandler.getDisconnectMessage().toPlainText()
} );
}
} else
{
ProxyServer.getInstance().getLogger().log( Level.INFO, "{0} has disconnected", handler );
}
}
}
}
Expand Down

0 comments on commit 46fddc4

Please sign in to comment.