detectPublicIp

public Optional<String> detectPublicIp()

Best-effort public IPv4 detection. Used by AutoHost when selfHostExternalHost is not configured — the plugin has no other way to know its own publicly-routable address (Bukkit.getIp() returns the bind address, which is often 0.0.0.0 or a private LAN address).

Sends a GET to a small set of well-known third-party "what's my IP" endpoints and returns the first non-empty response that parses as an IPv4 dotted-quad. Returns empty if every endpoint fails or returns garbage — caller should treat that as "we can't probe, fall back to remote hosting" rather than risk publishing a 0.0.0.0 URL to clients.

Endpoints (in order):

  1. https://api.ipify.org — plain-text IPv4, no rate limit on the free tier as of 2026.
  2. https://checkip.amazonaws.com — AWS-hosted, plain text with trailing newline, used as fallback when ipify is degraded.