From ff0f83b375191a6d374a4bffb0db2f34cd14a8fa Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sun, 2 Sep 2018 16:34:25 -0400 Subject: [PATCH] Add getBoundAddress() for NuVotifier --- .../java/com/velocitypowered/api/proxy/ProxyServer.java | 8 ++++++++ .../java/com/velocitypowered/proxy/VelocityServer.java | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/api/src/main/java/com/velocitypowered/api/proxy/ProxyServer.java b/api/src/main/java/com/velocitypowered/api/proxy/ProxyServer.java index a2af42b28..b4c851c58 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/ProxyServer.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/ProxyServer.java @@ -8,6 +8,7 @@ import com.velocitypowered.api.proxy.messages.ChannelRegistrar; import com.velocitypowered.api.scheduler.Scheduler; import com.velocitypowered.api.proxy.server.ServerInfo; +import java.net.InetSocketAddress; import java.util.Collection; import java.util.Optional; import java.util.UUID; @@ -107,4 +108,11 @@ public interface ProxyServer { * @return the channel registrar */ ChannelRegistrar getChannelRegistrar(); + + /** + * Gets the address that this proxy is bound to. This does not necessarily indicate the external IP address of the + * proxy. + * @return the address the proxy is bound to + */ + InetSocketAddress getBoundAddress(); } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java b/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java index 857354ebd..d23709111 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java @@ -39,6 +39,7 @@ import net.kyori.text.serializer.GsonComponentSerializer; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import java.net.InetSocketAddress; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -306,4 +307,9 @@ public class VelocityServer implements ProxyServer { public VelocityChannelRegistrar getChannelRegistrar() { return channelRegistrar; } + + @Override + public InetSocketAddress getBoundAddress() { + return configuration.getBind(); + } }