Class ClassiCubeHandler

java.lang.Object
de.florianmichael.classic4j.ClassiCubeHandler

public final class ClassiCubeHandler extends Object
This class provides methods to interact with the ClassiCube API.
  • Field Details

    • GSON

      public static final com.google.gson.Gson GSON
    • CLASSICUBE_ROOT_URI

      public static final URI CLASSICUBE_ROOT_URI
      The URI to the ClassiCube root.
    • AUTHENTICATION_URI

      public static final URI AUTHENTICATION_URI
    • SERVER_INFO_URI

      public static final URI SERVER_INFO_URI
    • SERVER_LIST_INFO_URI

      public static final URI SERVER_LIST_INFO_URI
  • Constructor Details

    • ClassiCubeHandler

      public ClassiCubeHandler()
  • Method Details

    • requestServerList

      public static void requestServerList(CCAccount account, Consumer<CCServerList> complete)
      Requests the ClassiCube server list and returns it as a CCServerList object.
      Parameters:
      account - The account to use for the request.
      complete - The consumer that will be called when the request is complete.
    • requestServerList

      public static void requestServerList(CCAccount account, Consumer<CCServerList> complete, Consumer<Throwable> throwableConsumer)
      Requests the ClassiCube server list and returns it as a CCServerList object.
      Parameters:
      account - The account to use for the request.
      complete - The consumer that will be called when the request is complete.
      throwableConsumer - The consumer that will be called when an error occurs.
    • requestServerInfo

      public static void requestServerInfo(CCAccount account, String serverHash, Consumer<CCServerList> complete)
      Requests the ClassiCube server list and returns it as a CCServerList object.
      Parameters:
      account - The account to use for the request.
      serverHash - The server hash to request.
      complete - The consumer that will be called when the request is complete.
    • requestServerInfo

      public static void requestServerInfo(CCAccount account, String serverHash, Consumer<CCServerList> complete, Consumer<Throwable> throwableConsumer)
      Requests the ClassiCube server list and returns it as a CCServerList object.
      Parameters:
      account - The account to use for the request.
      serverHash - The server hash to request.
      complete - The consumer that will be called when the request is complete.
      throwableConsumer - The consumer that will be called when an error occurs.
    • requestServerInfo

      public static void requestServerInfo(CCAccount account, List<String> serverHashes, Consumer<CCServerList> complete)
      Requests the ClassiCube server list and returns it as a CCServerList object.
      Parameters:
      account - The account to use for the request.
      serverHashes - The server hashes to request.
      complete - The consumer that will be called when the request is complete.
    • requestServerInfo

      public static void requestServerInfo(CCAccount account, List<String> serverHashes, Consumer<CCServerList> complete, Consumer<Throwable> throwableConsumer)
      Requests the ClassiCube server list and returns it as a CCServerList object.
      Parameters:
      account - The account to use for the request.
      serverHashes - The server hashes to request.
      complete - The consumer that will be called when the request is complete.
      throwableConsumer - The consumer that will be called when an error occurs.
    • requestAuthentication

      public static void requestAuthentication(CCAccount account, String loginCode, LoginProcessHandler processHandler)
      Authenticates the given account with the given login code. The LoginProcessHandler will be called when the login process is complete. If the login process fails, the LoginProcessHandler.handleException(Throwable) method will be called. If the login process requires MFA, the LoginProcessHandler.handleMfa(CCAccount) method will be called. If the login process is successful, the LoginProcessHandler.handleSuccessfulLogin(CCAccount) method will be called. If the login process is successful, the account will be updated with the new token. If it is the first login, the loginCode parameter can be null. To authenticate an account with MFA, you call this method twice, once with null as loginCode and once with the MFA code you received.
      Parameters:
      account - The account to authenticate.
      loginCode - The login code to use.
      processHandler - The handler to use for the login process.