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:
Ursprung
e21cd77ae7
Commit
8dd83193c8
@ -4,7 +4,6 @@ import com.google.common.base.Preconditions;
|
|||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import net.kyori.minecraft.Key;
|
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,16 +69,6 @@ public final class MinecraftChannelIdentifier implements ChannelIdentifier {
|
|||||||
return create(namespace, name);
|
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() {
|
public String getNamespace() {
|
||||||
return namespace;
|
return namespace;
|
||||||
}
|
}
|
||||||
@ -88,10 +77,6 @@ public final class MinecraftChannelIdentifier implements ChannelIdentifier {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Key asKey() {
|
|
||||||
return Key.of(namespace, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return namespace + ":" + name + " (modern)";
|
return namespace + ":" + name + " (modern)";
|
||||||
|
@ -120,7 +120,7 @@ public class StatusSessionHandler implements MinecraftSessionHandler {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.getDescriptionComponent() == null) {
|
if (response.getDescription() == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,10 +16,12 @@ 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;
|
||||||
|
|
||||||
@ -168,7 +170,9 @@ 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());
|
||||||
InetSocketAddress iaddr = server.getServerInfo().getAddress();
|
SocketAddress address = 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());
|
||||||
@ -176,6 +180,12 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren