public class MCPing<R extends IPingResponse>
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
MCPing<R> |
address(java.net.InetAddress address)
Set the address of the server to ping.
|
MCPing<R> |
address(ServerAddress serverAddress)
Set the address of the server to ping.
|
MCPing<R> |
address(java.net.SocketAddress address)
Set the address of the server to ping.
|
MCPing<R> |
address(java.lang.String address)
Set the address of the server to ping.
|
MCPing<R> |
address(java.lang.String host,
int port)
Set the address of the server to ping.
|
MCPing<R> |
connectedHandler(java.lang.Runnable connectedHandler)
Set a dedicated connected handler.
|
MCPing<R> |
exceptionHandler(java.util.function.Consumer<java.lang.Throwable> exceptionHandler)
Set a dedicated exception handler.
|
MCPing<R> |
finishHandler(java.util.function.Consumer<R> finishHandler)
Set a dedicated finish handler.
|
java.util.concurrent.CompletableFuture<R> |
getAsync()
Get a completable future for the ping response.
|
java.util.concurrent.Future<R> |
getAsync(java.util.concurrent.ExecutorService executor)
Get a future for the ping response.
|
R |
getSync()
Get the ping response synchronously.
|
MCPing<R> |
handler(IStatusListener statusListener)
Set the ping status listener.
|
MCPing<R> |
noResolve()
Set the address to not be resolved.
|
static MCPing<BedrockPingResponse> |
pingBedrock()
Ping a server using the bedrock protocol.
|
static MCPing<ClassicPingResponse> |
pingClassic(ClassicPing.Version version)
Ping a server using the classic protocol.
|
static MCPing<MCPingResponse> |
pingLegacy(LegacyPing.Version version)
Ping a server using the legacy ping protocol.
|
static MCPing<MCPingResponse> |
pingLegacy(LegacyPing.Version version,
int protocolVersion)
Ping a server using the legacy ping protocol.
|
static MCPing<MCPingResponse> |
pingModern()
Ping a server using the modern ping protocol.
|
static MCPing<MCPingResponse> |
pingModern(int protocolVersion)
Ping a server using the modern ping protocol.
|
static MCPing<QueryPingResponse> |
pingQuery()
Ping a server using the query protocol.
|
static MCPing<QueryPingResponse> |
pingQuery(boolean full)
Ping a server using the query protocol.
|
static MCPing<SocketPingResponse> |
pingSocket()
Ping a server using a socket.
|
MCPing<R> |
resolve()
Set the address to be resolved.
|
MCPing<R> |
responseHandler(java.util.function.Consumer<R> responseHandler)
Set a dedicated response handler.
|
MCPing<R> |
timeout(int connectTimeout,
int readTimeout)
Set the connect and read timeout.
|
public static MCPing<MCPingResponse> pingModern()
public static MCPing<MCPingResponse> pingModern(int protocolVersion)
protocolVersion - The protocol version to usepublic static MCPing<MCPingResponse> pingLegacy(LegacyPing.Version version)
LegacyPing.Version#getDefaultId()).version - The version of the protocolpublic static MCPing<MCPingResponse> pingLegacy(LegacyPing.Version version, int protocolVersion)
version - The version of the protocolprotocolVersion - The protocol version to usepublic static MCPing<ClassicPingResponse> pingClassic(ClassicPing.Version version)
version - The version of the protocolpublic static MCPing<QueryPingResponse> pingQuery()
public static MCPing<QueryPingResponse> pingQuery(boolean full)
full - Whether to use full query or notpublic static MCPing<BedrockPingResponse> pingBedrock()
public static MCPing<SocketPingResponse> pingSocket()
public MCPing<R> address(java.lang.String address)
ServerAddress.parse(String, int) for more information.address - The string representation of the address and/or portpublic MCPing<R> address(java.lang.String host, int port)
ServerAddress.of(String, int, int) for more information.host - The host of the serverport - The port of the serverpublic MCPing<R> address(ServerAddress serverAddress)
serverAddress - The server addresspublic MCPing<R> address(java.net.SocketAddress address)
InetSocketAddress the host and port will be used.ServerAddress.parse(String, int).address - The socket addresspublic MCPing<R> address(java.net.InetAddress address)
InetAddress.getHostAddress().address - The inet addresspublic MCPing<R> timeout(int connectTimeout, int readTimeout)
connectTimeout - The connect timeoutreadTimeout - The read timeoutpublic MCPing<R> handler(IStatusListener statusListener)
IStatusListener for more information about the response special cases.statusListener - The status listenerpublic MCPing<R> exceptionHandler(java.util.function.Consumer<java.lang.Throwable> exceptionHandler)
IStatusListener.onError(Throwable) for common exceptions and their cause.IStatusListener for more information about the response special cases.exceptionHandler - The exception handlerpublic MCPing<R> connectedHandler(java.lang.Runnable connectedHandler)
IStatusListener for more information about the response special cases.connectedHandler - The connected handlerpublic MCPing<R> responseHandler(java.util.function.Consumer<R> responseHandler)
IStatusListener for more information about the response special cases.responseHandler - The response handlerpublic MCPing<R> finishHandler(java.util.function.Consumer<R> finishHandler)
IStatusListener for more information about the response special cases.finishHandler - The finish handlerpublic R getSync()
java.lang.RuntimeException - If no status listener or exception handler is set and an exception occurspublic java.util.concurrent.CompletableFuture<R> getAsync()
public java.util.concurrent.Future<R> getAsync(java.util.concurrent.ExecutorService executor)
executor - The executor