From 830f18a35725f637d623594eaaad50b566376e59 Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Tue, 11 Nov 2014 10:32:39 +0000 Subject: [PATCH] Manually remove the player from everyone's tab list on disconnect This is needed because when the player disconnects from bungee they are removed from the connection map, this causes the tab-list rewrite to fail due the player no longer being on bungee and therefor it ends up not removing the player (online vs offline uuid). This would only happen on servers without ip-forwarding enabled --- .../bungee/connection/UpstreamBridge.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java index b6988a3d..2a42ab0f 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java @@ -5,6 +5,7 @@ import net.md_5.bungee.BungeeCord; import net.md_5.bungee.UserConnection; import net.md_5.bungee.Util; import net.md_5.bungee.api.ProxyServer; +import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.ChatEvent; import net.md_5.bungee.api.event.PlayerDisconnectEvent; import net.md_5.bungee.api.event.PluginMessageEvent; @@ -14,6 +15,7 @@ import net.md_5.bungee.netty.PacketHandler; import net.md_5.bungee.protocol.PacketWrapper; import net.md_5.bungee.protocol.packet.KeepAlive; import net.md_5.bungee.protocol.packet.Chat; +import net.md_5.bungee.protocol.packet.PlayerListItem; import net.md_5.bungee.protocol.packet.TabCompleteRequest; import net.md_5.bungee.protocol.packet.ClientSettings; import net.md_5.bungee.protocol.packet.PluginMessage; @@ -56,6 +58,23 @@ public class UpstreamBridge extends PacketHandler if ( con.getServer() != null ) { + // Manually remove from everyone's tab list + // since the packet from the server arrives + // too late + // TODO: This should only done with server_unique + // tab list (which is the only one supported + // currently) + PlayerListItem packet = new PlayerListItem(); + packet.setAction( PlayerListItem.Action.REMOVE_PLAYER ); + PlayerListItem.Item item = new PlayerListItem.Item(); + item.setUuid( con.getUniqueId() ); + packet.setItems( new PlayerListItem.Item[]{ + item + } ); + for ( ProxiedPlayer player : con.getServer().getInfo().getPlayers() ) + { + player.unsafe().sendPacket( packet ); + } con.getServer().disconnect( "Quitting" ); } }