3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 13:30:17 +01:00

Reapply f1cb3eb and add the same fix to ping passthrough

Dieser Commit ist enthalten in:
Andrew Steinborn 2021-04-22 11:22:55 -04:00
Ursprung a5565847d1
Commit e416b9fc45
2 geänderte Dateien mit 5 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -616,7 +616,9 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
*/ */
private Optional<RegisteredServer> getNextServerToTry(@Nullable RegisteredServer current) { private Optional<RegisteredServer> getNextServerToTry(@Nullable RegisteredServer current) {
if (serversToTry == null) { 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, serversToTry = server.configuration().getForcedHosts().getOrDefault(virtualHostStr,
Collections.emptyList()); Collections.emptyList());
} }

Datei anzeigen

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