From 8dd83193c8276669e29663ecb65a42a6f92f762b Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Wed, 28 Oct 2020 20:36:22 -0400 Subject: [PATCH] Manually merge in conflicting 2.0.0 changes into the 1.1.0 merge. --- .../messages/MinecraftChannelIdentifier.java | 15 ------------- .../client/StatusSessionHandler.java | 2 +- .../proxy/util/InformationUtils.java | 22 ++++++++++++++----- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/api/src/main/java/com/velocitypowered/api/proxy/messages/MinecraftChannelIdentifier.java b/api/src/main/java/com/velocitypowered/api/proxy/messages/MinecraftChannelIdentifier.java index 01a582035..9f3478232 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/messages/MinecraftChannelIdentifier.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/messages/MinecraftChannelIdentifier.java @@ -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)"; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/StatusSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/StatusSessionHandler.java index eefb485dd..f88e27e94 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/StatusSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/StatusSessionHandler.java @@ -120,7 +120,7 @@ public class StatusSessionHandler implements MinecraftSessionHandler { continue; } - if (response.getDescriptionComponent() == null) { + if (response.getDescription() == null) { continue; } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/util/InformationUtils.java b/proxy/src/main/java/com/velocitypowered/proxy/util/InformationUtils.java index 89f24ab9c..1470d2337 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/util/InformationUtils.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/util/InformationUtils.java @@ -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,14 +170,22 @@ public enum InformationUtils { public static JsonObject collectServerInfo(RegisteredServer server) { JsonObject info = new JsonObject(); info.addProperty("currentPlayers", server.getPlayersConnected().size()); - InetSocketAddress iaddr = server.getServerInfo().getAddress(); - if (iaddr.isUnresolved()) { - // Greetings form Netty 4aa10db9 - info.addProperty("host", iaddr.getHostString()); + 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()); + } else { + 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("host", anonymizeInetAddress(iaddr.getAddress())); + info.addProperty("info", address.toString()); } - info.addProperty("port", iaddr.getPort()); return info; }