3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-12-24 15:20:35 +01:00

Fix SpotBugs complaint

Dieser Commit ist enthalten in:
Andrew Steinborn 2020-10-26 20:58:20 -04:00
Ursprung 45752d5ea4
Commit 536049995d

Datei anzeigen

@ -16,13 +16,10 @@ 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;
@ -170,22 +167,14 @@ public enum InformationUtils {
public static JsonObject collectServerInfo(RegisteredServer server) {
JsonObject info = new JsonObject();
info.addProperty("currentPlayers", server.getPlayersConnected().size());
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());
InetSocketAddress iaddr = server.getServerInfo().getAddress();
if (iaddr.isUnresolved()) {
// Greetings form Netty 4aa10db9
info.addProperty("host", iaddr.getHostString());
} else {
info.addProperty("info", address.toString());
info.addProperty("host", anonymizeInetAddress(iaddr.getAddress()));
}
info.addProperty("port", iaddr.getPort());
return info;
}