From addf81f92aacad0b66e42c2d30cc84035f7fa06b Mon Sep 17 00:00:00 2001 From: KaneFreeman Date: Wed, 9 Jan 2013 23:23:24 -0500 Subject: [PATCH] Properly remove UserConnection from server's list Previous version did not properly remove a UserConnection from the server's list when they change servers. This version also prevent duplicates from being placed in a server's list. --- src/main/java/net/md_5/bungee/UserConnection.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/md_5/bungee/UserConnection.java b/src/main/java/net/md_5/bungee/UserConnection.java index dfe23c3e..c09e57ad 100644 --- a/src/main/java/net/md_5/bungee/UserConnection.java +++ b/src/main/java/net/md_5/bungee/UserConnection.java @@ -115,6 +115,14 @@ public class UserConnection extends GenericConnection implements CommandSender } reconnecting = false; downBridge = new DownstreamBridge(); + if (server != null) + { + List conns = BungeeCord.instance.connectionsByServer.get(server.name); + if (conns != null) + { + conns.remove(this); + } + } server = newServer; List conns = BungeeCord.instance.connectionsByServer.get(server.name); if (conns == null) @@ -122,7 +130,10 @@ public class UserConnection extends GenericConnection implements CommandSender conns = new ArrayList<>(); BungeeCord.instance.connectionsByServer.put(server.name, conns); } - conns.add(this); + if (!conns.contains(this)) + { + conns.add(this); + } downBridge.start(); } catch (KickException ex) {