Added API to get player ha proxy address

This commit is contained in:
nostalfinals
2024-04-08 23:24:38 +08:00
parent d5b93a0167
commit 445e9a65fb
3 changed files with 36 additions and 19 deletions

View File

@@ -270,7 +270,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public InetSocketAddress getAddress() {
if (this.getHandle().connection.protocol() == null) return null;
if (this.getHandle().connection == null) return null;
SocketAddress addr = this.getHandle().connection.getRemoteAddress();
if (addr instanceof InetSocketAddress) {
@@ -280,6 +280,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
}
// Paper start - Add API to get player's proxy address
@Override
public @Nullable InetSocketAddress getHAProxyAddress() {
if (this.getHandle().connection == null) return null;
return this.getHandle().connection.connection.haProxyAddress instanceof final InetSocketAddress inetSocketAddress ? inetSocketAddress : null;
}
// Paper end - Add API to get player's proxy address
public interface TransferCookieConnection {
boolean isTransferred();