@@ -0,0 +1,3076 @@
+package io.github.teamdevintia.round2.bungee;%0A%0Aimport net.md_5.bungee.api.ChatColor;%0Aimport net.md_5.bungee.api.ProxyServer;%0Aimport net.md_5.bungee.api.chat.ComponentBuilder;%0Aimport net.md_5.bungee.api.config.ServerInfo;%0Aimport net.md_5.bungee.api.connection.ProxiedPlayer;%0Aimport net.md_5.bungee.config.Configuration;%0Aimport net.md_5.bungee.config.ConfigurationProvider;%0Aimport net.md_5.bungee.config.YamlConfiguration;%0A%0Aimport java.io.File;%0Aimport java.net.InetSocketAddress;%0Aimport java.util.logging.Level;%0A%0A/**%0A * Allows to easily do stuff, like ading and removing servers%0A *%0A * @author MiniDigger%0A */%0Apublic class API %7B%0A%0A    /**%0A     * Adds a server to the proxy%0A     *%0A     * @param name the name of the server%0A     * @param host the host address of the server%0A     * @param port the port of the server%0A     * @return weather or not is was successful%0A     */%0A    public static boolean addServer(String name, String host, int port) %7B%0A        if (ProxyServer.getInstance().getServers().containsKey(name)) %7B%0A            return false;%0A        %7D%0A        ServerInfo serverInfo = ProxyServer.getInstance().constructServerInfo(name, new InetSocketAddress(host, port), %22%22, false);%0A        ProxyServer.getInstance().getServers().put(name, serverInfo);%0A        try %7B%0A            Configuration bungeeConfig = ConfigurationProvider.getProvider(YamlConfiguration.class).load(new File(%22config.yml%22));%0A            bungeeConfig.set(%22servers.%22 + name + %22.address%22, host + %22:%22 + port);%0A            bungeeConfig.set(%22servers.%22 + name + %22.restricted%22, false);%0A            bungeeConfig.set(%22servers.%22 + name + %22.motd%22, %22%22);%0A            ConfigurationProvider.getProvider(YamlConfiguration.class).save(bungeeConfig, new File(%22config.yml%22));%0A        %7D catch (Exception e) %7B%0A            ProxyServer.getInstance().getLogger().log(Level.SEVERE, %22Could not add server to config%22, e);%0A            return false;%0A        %7D%0A        return true;%0A    %7D%0A%0A    /**%0A     * Removes a server from the proxy%0A     *%0A     * @param name the name of the server to be removed%0A     * @return weather or not is was successful%0A     */%0A    public static boolean removeServer(String name) %7B%0A        if (!ProxyServer.getInstance().getServers().containsKey(name)) %7B%0A            return false;%0A        %7D%0A        for (final ProxiedPlayer player : ProxyServer.getInstance().getServers().get(name).getPlayers()) %7B%0A            player.disconnect(new ComponentBuilder(%22Server was stopped, please rejoin.%22).color(ChatColor.GRAY).create());%0A        %7D%0A        ProxyServer.getInstance().getServers().remove(name);%0A        try %7B%0A            Configuration bungeeConfig = ConfigurationProvider.getProvider(YamlConfiguration.class).load(new File(%22config.yml%22));%0A            bungeeConfig.set(%22servers.%22 + name, null);%0A            ConfigurationProvider.getProvider(YamlConfiguration.class).save(bungeeConfig, new File(%22config.yml%22));%0A        %7D catch (Exception e) %7B%0A            ProxyServer.getInstance().getLogger().log(Level.SEVERE, %22Could not remove server from config%22, e);%0A            return false;%0A        %7D%0A        return true;%0A    %7D%0A%7D%0A

add methods to add and remove servers to the proxy