3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-12-26 00:00:55 +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.proxy.server.RegisteredServer;
import com.velocitypowered.api.util.ProxyVersion; import com.velocitypowered.api.util.ProxyVersion;
import io.netty.channel.unix.DomainSocketAddress;
import java.net.Inet4Address; import java.net.Inet4Address;
import java.net.Inet6Address; import java.net.Inet6Address;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -170,9 +167,7 @@ public enum InformationUtils {
public static JsonObject collectServerInfo(RegisteredServer server) { public static JsonObject collectServerInfo(RegisteredServer server) {
JsonObject info = new JsonObject(); JsonObject info = new JsonObject();
info.addProperty("currentPlayers", server.getPlayersConnected().size()); info.addProperty("currentPlayers", server.getPlayersConnected().size());
SocketAddress address = server.getServerInfo().getAddress(); InetSocketAddress iaddr = server.getServerInfo().getAddress();
if (address instanceof InetSocketAddress) {
InetSocketAddress iaddr = (InetSocketAddress) address;
if (iaddr.isUnresolved()) { if (iaddr.isUnresolved()) {
// Greetings form Netty 4aa10db9 // Greetings form Netty 4aa10db9
info.addProperty("host", iaddr.getHostString()); info.addProperty("host", iaddr.getHostString());
@ -180,12 +175,6 @@ public enum InformationUtils {
info.addProperty("host", anonymizeInetAddress(iaddr.getAddress())); info.addProperty("host", anonymizeInetAddress(iaddr.getAddress()));
} }
info.addProperty("port", iaddr.getPort()); 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; return info;
} }