Reapply f1cb3eb and add the same fix to ping passthrough

This commit is contained in:
Andrew Steinborn
2021-04-22 11:22:55 -04:00
parent a5565847d1
commit e416b9fc45
2 changed files with 5 additions and 1 deletions

View File

@@ -616,7 +616,9 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
*/
private Optional<RegisteredServer> getNextServerToTry(@Nullable RegisteredServer current) {
if (serversToTry == null) {
String virtualHostStr = connectedHost().map(InetSocketAddress::getHostString).orElse("");
String virtualHostStr = connectedHost().map(InetSocketAddress::getHostString)
.orElse("")
.toLowerCase(Locale.ROOT);
serversToTry = server.configuration().getForcedHosts().getOrDefault(virtualHostStr,
Collections.emptyList());
}

View File

@@ -42,6 +42,7 @@ import io.netty.buffer.ByteBuf;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import org.apache.logging.log4j.LogManager;
@@ -168,6 +169,7 @@ public class StatusSessionHandler implements MinecraftSessionHandler {
return CompletableFuture.completedFuture(constructLocalPing(shownVersion));
} else {
String virtualHostStr = inbound.connectedHost().map(InetSocketAddress::getHostString)
.map(str -> str.toLowerCase(Locale.ROOT))
.orElse("");
List<String> serversToTry = server.configuration().getForcedHosts().getOrDefault(
virtualHostStr, server.configuration().getAttemptConnectionOrder());