broadcast message on player leaving, like joins

Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
This commit is contained in:
Jamin W. Collins
2018-03-06 17:26:51 -07:00
parent 534a161dc0
commit d9913ffb1e

View File

@@ -323,8 +323,10 @@ public final class FServerManager {
@Override @Override
public void channelInactive(final ChannelHandlerContext ctx) throws Exception { public void channelInactive(final ChannelHandlerContext ctx) throws Exception {
final RemoteClient client = clients.remove(ctx.channel()); final RemoteClient client = clients.remove(ctx.channel());
final String username = client.getUsername();
localLobby.disconnectPlayer(client.getIndex()); localLobby.disconnectPlayer(client.getIndex());
broadcast(new LogoutEvent(client.getUsername())); broadcast(new MessageEvent(String.format("%s left the room", username)));
broadcast(new LogoutEvent(username));
super.channelInactive(ctx); super.channelInactive(ctx);
} }
} }