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

Manually merge in conflicting 2.0.0 changes into the 1.1.0 merge.

Dieser Commit ist enthalten in:
Andrew Steinborn 2020-10-28 20:36:22 -04:00
Ursprung e21cd77ae7
Commit 8dd83193c8
3 geänderte Dateien mit 17 neuen und 22 gelöschten Zeilen

Datei anzeigen

@ -4,7 +4,6 @@ import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import java.util.Objects;
import java.util.regex.Pattern;
import net.kyori.minecraft.Key;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
@ -70,16 +69,6 @@ public final class MinecraftChannelIdentifier implements ChannelIdentifier {
return create(namespace, name);
}
/**
* Creates an channel identifier from the specified Minecraft identifier.
*
* @param key the Minecraft key to use
* @return a new channel identifier
*/
public static MinecraftChannelIdentifier from(Key key) {
return create(key.namespace(), key.value());
}
public String getNamespace() {
return namespace;
}
@ -88,10 +77,6 @@ public final class MinecraftChannelIdentifier implements ChannelIdentifier {
return name;
}
public Key asKey() {
return Key.of(namespace, name);
}
@Override
public String toString() {
return namespace + ":" + name + " (modern)";

Datei anzeigen

@ -120,7 +120,7 @@ public class StatusSessionHandler implements MinecraftSessionHandler {
continue;
}
if (response.getDescriptionComponent() == null) {
if (response.getDescription() == null) {
continue;
}

Datei anzeigen

@ -16,10 +16,12 @@ import com.velocitypowered.api.proxy.config.ProxyConfig;
import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.api.util.ProxyVersion;
import io.netty.channel.unix.DomainSocketAddress;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.List;
import java.util.Map;
@ -168,7 +170,9 @@ public enum InformationUtils {
public static JsonObject collectServerInfo(RegisteredServer server) {
JsonObject info = new JsonObject();
info.addProperty("currentPlayers", server.getPlayersConnected().size());
InetSocketAddress iaddr = server.getServerInfo().getAddress();
SocketAddress address = server.getServerInfo().getAddress();
if (address instanceof InetSocketAddress) {
InetSocketAddress iaddr = (InetSocketAddress) address;
if (iaddr.isUnresolved()) {
// Greetings form Netty 4aa10db9
info.addProperty("host", iaddr.getHostString());
@ -176,6 +180,12 @@ public enum InformationUtils {
info.addProperty("host", anonymizeInetAddress(iaddr.getAddress()));
}
info.addProperty("port", iaddr.getPort());
} else if (address instanceof DomainSocketAddress) {
DomainSocketAddress daddr = (DomainSocketAddress) address;
info.addProperty("path", daddr.path());
} else {
info.addProperty("info", address.toString());
}
return info;
}