Class PingResult
java.lang.Object
me.internalizable.numdrassl.api.server.PingResult
Result of pinging a backend server.
-
Method Summary
Modifier and TypeMethodDescriptionstatic PingResultCreate a failed ping result.getError()Get the error message if the ping failed.longGet the latency to the server in milliseconds.booleanisOnline()Check if the server is online.static PingResultsuccess(long latencyMs) Create a successful ping result.
-
Method Details
-
isOnline
public boolean isOnline()Check if the server is online.- Returns:
- true if online
-
getLatencyMs
public long getLatencyMs()Get the latency to the server in milliseconds.- Returns:
- the latency, or -1 if offline
-
getError
Get the error message if the ping failed.- Returns:
- the error message, or null if successful
-
success
Create a successful ping result.- Parameters:
latencyMs- the latency in milliseconds- Returns:
- a success result
-
failure
Create a failed ping result.- Parameters:
error- the error message- Returns:
- a failure result
-