  
  import net.md_5.bungee.BungeeCord;
  import net.md_5.bungee.api.Favicon;
-@@ -61,6 +63,7 @@ public abstract class Configuration implements ProxyConfig
+@@ -42,6 +44,7 @@ public abstract class Configuration implements ProxyConfig
+      * Set of all listeners.
+      */
+     private Collection<ListenerInfo> listeners;
++    private final Object serversLock = new Object(); // Waterfall
+     /**
+      * Set of all servers.
+      */
+@@ -61,6 +64,7 @@ public abstract class Configuration implements ProxyConfig
      private Favicon favicon;
      private int compressionThreshold = 256;
  
-+    @Synchronized("servers") // Waterfall
++    @Synchronized("serversLock") // Waterfall
      public void load()
      {
          ConfigurationAdapter adapter = ProxyServer.getInstance().getConfigurationAdapter();
-@@ -100,7 +103,7 @@ public abstract class Configuration implements ProxyConfig
+@@ -100,7 +104,7 @@ public abstract class Configuration implements ProxyConfig
              servers = new CaseInsensitiveMap<>( newServers );
          } else
          {

+    }
+
+    @Override
+    @Synchronized("servers")
+    public ServerInfo removeServerNamed(String name)
+    {
+        return this.servers.remove( name );
+    }
+
+    @Override
+    @Synchronized("servers")
+    public ServerInfo removeServer(ServerInfo server)
+    {
+        return this.servers.remove( server.getName() );
+    }
+
+    @Override
+    @Synchronized("servers")
+    public boolean removeServersNamed(Collection<String> names)
+    {
+        return this.servers.keySet().removeAll( names );
+    }
+
+    @Override
+    @Synchronized("servers")
+    public boolean removeServers(Collection<ServerInfo> servers)
+    {
+        boolean changed = false;

From d7d5585dd6576c5ee2d50c88f5b020ab96726138 Mon Sep 17 00:00:00 2001
From: Troy Frew <fuzzy_bot@arenaga.me>
Date: Wed, 29 Jun 2016 04:29:25 +0200
Subject: [PATCH] Add dynamic server addition/removal api.

The provided methods will not move a player if a server is removed or the server ip/port is changed, however the methods return the old ServerInfo object for you to handle that yourself if needed.
