public class ServerAddress
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
int |
getDefaultPort() |
java.lang.String |
getHost() |
int |
getPort() |
java.lang.String |
getUnresolvedHost() |
int |
getUnresolvedPort() |
boolean |
isResolved() |
static ServerAddress |
of(java.lang.String host,
int port,
int defaultPort)
Get a server address from the given host, port and default port.
|
static ServerAddress |
parse(java.lang.String address,
int defaultPort)
Parse a server address from the given string.
|
void |
resolve()
Resolve the server address using the {@code _minecraft.
|
java.net.InetSocketAddress |
toInetSocketAddress()
Get an
InetSocketAddress from this server address. |
public static ServerAddress of(java.lang.String host, int port, int defaultPort)
host - The server hostport - The server portdefaultPort - The default port of the ping protocolpublic static ServerAddress parse(java.lang.String address, int defaultPort)
host:port or just host.address - The string to parsedefaultPort - The default port of the ping protocoljava.lang.IllegalArgumentException - If the string is not in the correct formatpublic java.lang.String getUnresolvedHost()
public int getUnresolvedPort()
public java.lang.String getHost()
public int getPort()
public int getDefaultPort()
public boolean isResolved()
public java.net.InetSocketAddress toInetSocketAddress()
InetSocketAddress from this server address.public void resolve()
_minecraft._tcp. SRV record.java.lang.IllegalStateException - If the dns context could not be initialized