mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-24 03:05:49 +01:00
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.
This commit is contained in:
parent
90e1bc6dd8
commit
addf81f92a
@ -115,6 +115,14 @@ public class UserConnection extends GenericConnection implements CommandSender
|
||||
}
|
||||
reconnecting = false;
|
||||
downBridge = new DownstreamBridge();
|
||||
if (server != null)
|
||||
{
|
||||
List<UserConnection> conns = BungeeCord.instance.connectionsByServer.get(server.name);
|
||||
if (conns != null)
|
||||
{
|
||||
conns.remove(this);
|
||||
}
|
||||
}
|
||||
server = newServer;
|
||||
List<UserConnection> 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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user