Class PingResult

java.lang.Object
me.internalizable.numdrassl.api.server.PingResult

public final class PingResult extends Object
Result of pinging a backend server.
  • 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

      @Nullable public String getError()
      Get the error message if the ping failed.
      Returns:
      the error message, or null if successful
    • success

      public static PingResult success(long latencyMs)
      Create a successful ping result.
      Parameters:
      latencyMs - the latency in milliseconds
      Returns:
      a success result
    • failure

      public static PingResult failure(String error)
      Create a failed ping result.
      Parameters:
      error - the error message
      Returns:
      a failure result