geforkt von Mirrors/Velocity
Initial implementation of raw registered server creation.
Dieser Commit ist enthalten in:
Ursprung
04db382a18
Commit
150808b4b0
@ -105,6 +105,14 @@ public interface ProxyServer extends Audience {
|
||||
*/
|
||||
Collection<RegisteredServer> matchServer(String partialName);
|
||||
|
||||
/**
|
||||
* Creates a raw {@link RegisteredServer} without tying it into the internal server map.
|
||||
*
|
||||
* @param server the server to register
|
||||
* @return the {@link RegisteredServer} implementation created by the provided {@link ServerInfo}.
|
||||
*/
|
||||
RegisteredServer createRawRegisteredServer(ServerInfo server);
|
||||
|
||||
/**
|
||||
* Registers a server with this proxy. A server with this name should not already exist.
|
||||
*
|
||||
|
@ -600,6 +600,11 @@ public class VelocityServer implements ProxyServer, ForwardingAudience {
|
||||
return servers.getAllServers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegisteredServer createRawRegisteredServer(ServerInfo server) {
|
||||
return servers.createRawRegisteredServer(server);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegisteredServer registerServer(ServerInfo server) {
|
||||
return servers.register(server);
|
||||
|
@ -54,6 +54,17 @@ public class ServerMap {
|
||||
return ImmutableList.copyOf(servers.values());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a raw implementation of a {@link RegisteredServer} without
|
||||
* tying it to the internal server map.
|
||||
*
|
||||
* @param serverInfo the server to create a registered server with
|
||||
* @return the {@link RegisteredServer} built from the {@link ServerInfo}
|
||||
*/
|
||||
public RegisteredServer createRawRegisteredServer(ServerInfo serverInfo) {
|
||||
return new VelocityRegisteredServer(server, serverInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a server with the proxy.
|
||||
*
|
||||
@ -63,7 +74,7 @@ public class ServerMap {
|
||||
public RegisteredServer register(ServerInfo serverInfo) {
|
||||
Preconditions.checkNotNull(serverInfo, "serverInfo");
|
||||
String lowerName = serverInfo.getName().toLowerCase(Locale.US);
|
||||
VelocityRegisteredServer rs = new VelocityRegisteredServer(server, serverInfo);
|
||||
RegisteredServer rs = createRawRegisteredServer(serverInfo);
|
||||
|
||||
RegisteredServer existing = servers.putIfAbsent(lowerName, rs);
|
||||
if (existing != null && !existing.getServerInfo().equals(serverInfo)) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren