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;
|
reconnecting = false;
|
||||||
downBridge = new DownstreamBridge();
|
downBridge = new DownstreamBridge();
|
||||||
|
if (server != null)
|
||||||
|
{
|
||||||
|
List<UserConnection> conns = BungeeCord.instance.connectionsByServer.get(server.name);
|
||||||
|
if (conns != null)
|
||||||
|
{
|
||||||
|
conns.remove(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
server = newServer;
|
server = newServer;
|
||||||
List<UserConnection> conns = BungeeCord.instance.connectionsByServer.get(server.name);
|
List<UserConnection> conns = BungeeCord.instance.connectionsByServer.get(server.name);
|
||||||
if (conns == null)
|
if (conns == null)
|
||||||
@ -122,7 +130,10 @@ public class UserConnection extends GenericConnection implements CommandSender
|
|||||||
conns = new ArrayList<>();
|
conns = new ArrayList<>();
|
||||||
BungeeCord.instance.connectionsByServer.put(server.name, conns);
|
BungeeCord.instance.connectionsByServer.put(server.name, conns);
|
||||||
}
|
}
|
||||||
conns.add(this);
|
if (!conns.contains(this))
|
||||||
|
{
|
||||||
|
conns.add(this);
|
||||||
|
}
|
||||||
downBridge.start();
|
downBridge.start();
|
||||||
} catch (KickException ex)
|
} catch (KickException ex)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user