Add server registration API.

This commit is contained in:
Andrew Steinborn
2018-08-05 17:10:18 -04:00
parent 23a6488a39
commit a778825152
3 changed files with 83 additions and 7 deletions

View File

@@ -1,5 +1,7 @@
package com.velocitypowered.api.proxy;
import com.velocitypowered.api.server.ServerInfo;
import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.Optional;
@@ -29,4 +31,29 @@ public interface ProxyServer {
* @return the players online on this proxy
*/
Collection<Player> getAllPlayers();
/**
* Retrieves a registered {@link ServerInfo} instance by its name.
* @param name the name of the server
* @return the server
*/
Optional<ServerInfo> getServerInfo(@Nonnull String name);
/**
* Retrieves all {@link ServerInfo}s registered with this proxy.
* @return the servers registered with this proxy
*/
Collection<ServerInfo> getAllServers();
/**
* Registers a server with this proxy. A server with this name should not already exist.
* @param server the server to register
*/
void registerServer(@Nonnull ServerInfo server);
/**
* Unregisters this server from the proxy.
* @param server the server to unregister
*/
void unregisterServer(@Nonnull ServerInfo server);
}