Пример #1
0
 @LauncherAPI
 public static AuthProvider newProvider(String name, BlockConfigEntry block) {
   VerifyHelper.verifyIDName(name);
   Adapter<AuthProvider> authHandlerAdapter =
       VerifyHelper.getMapValue(
           AUTH_PROVIDERS, name, String.format("Unknown auth provider: '%s'", name));
   return authHandlerAdapter.convert(block);
 }
Пример #2
0
 @LauncherAPI
 public static void registerProvider(String name, Adapter<AuthProvider> adapter) {
   VerifyHelper.putIfAbsent(
       AUTH_PROVIDERS,
       name,
       Objects.requireNonNull(adapter, "adapter"),
       String.format("Auth provider has been already registered: '%s'", name));
 }
Пример #3
0
  @LauncherAPI
  public void verify() {
    // Version
    getVersion();
    IOHelper.verifyFileName(getAssetIndex());

    // Client
    VerifyHelper.verify(getTitle(), VerifyHelper.NOT_EMPTY, "Profile title can't be empty");
    VerifyHelper.verify(
        getServerAddress(), VerifyHelper.NOT_EMPTY, "Server address can't be empty");
    VerifyHelper.verifyInt(
        getServerPort(), VerifyHelper.range(0, 65535), "Illegal server port: " + getServerPort());

    //  Updater and client watch service
    update.verifyOfType(ConfigEntry.Type.STRING);
    updateVerify.verifyOfType(ConfigEntry.Type.STRING);
    updateExclusions.verifyOfType(ConfigEntry.Type.STRING);

    // Client launcher
    jvmArgs.verifyOfType(ConfigEntry.Type.STRING);
    classPath.verifyOfType(ConfigEntry.Type.STRING);
    clientArgs.verifyOfType(ConfigEntry.Type.STRING);
    VerifyHelper.verify(getTitle(), VerifyHelper.NOT_EMPTY, "Main class can't be empty");
  }
Пример #4
0
 public static Version byName(String name) {
   return VerifyHelper.getMapValue(
       VERSIONS, name, String.format("Unknown client version: '%s'", name));
 }