Make RegisteredServer implementations stateless
This is a first attempt at solving #566.
This shifts the stateful logic behind VelocityRegisteredServer (keeping track of connected players and sending plugin messages to those players) to a new class (VelocityServerState, backed by the RegisteredServerState API).
This way one could make a custom RegisteredServer that doesn't have to be registered to the proxy, perhaps forwarding the stateful logic to a server that's actually registered. (server aliasing)
For instance, you can now write this:
public class AliasedServer implements RegisteredServer {
private final RegisteredServer handle;
private final ServerInfo serverInfo;
public AliasedServer(RegisteredServer handle, String alias) {
this.handle = handle;
this.serverInfo = new ServerInfo(alias, handle.getServerInfo().getAddress());
}
@Override
public ServerInfo getServerInfo() {
return serverInfo;
}
@Override
public CompletableFuture<ServerPing> ping() {
return handle.ping();
}
@Override
public RegisteredServerState getState() {
return handle.getState();
}
}
This is a breaking API change, but backwards compatibility is kept through deprecated methods.
What's the status on this? This feature is pretty critical for servers utilizing something like Kubernetes where ip addresses are constantly changing.
What's the status on this? This feature is pretty critical for servers utilizing something like Kubernetes where ip addresses are constantly changing.
I think it's being taken a different way in design - I'm going to write up a UML + draft PR for the overhaul this weekend, see the initial issue in the post, it should be able to be done without any breaking changes at all.