geforkt von Mirrors/Velocity
Fix SpotBugs complaint
Dieser Commit ist enthalten in:
Ursprung
45752d5ea4
Commit
536049995d
@ -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,22 +167,14 @@ 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) {
|
if (iaddr.isUnresolved()) {
|
||||||
InetSocketAddress iaddr = (InetSocketAddress) address;
|
// Greetings form Netty 4aa10db9
|
||||||
if (iaddr.isUnresolved()) {
|
info.addProperty("host", iaddr.getHostString());
|
||||||
// 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 {
|
} else {
|
||||||
info.addProperty("info", address.toString());
|
info.addProperty("host", anonymizeInetAddress(iaddr.getAddress()));
|
||||||
}
|
}
|
||||||
|
info.addProperty("port", iaddr.getPort());
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren