Class UpdateBuilder

java.lang.Object
io.github.projectunified.mcserverupdater.UpdateBuilder

public final class UpdateBuilder extends Object
Where to create the update process
  • Method Details

    • registerUpdater

      public static void registerUpdater(Function<VersionQuery,Updater> updater, String... names)
      Register a updater
      Parameters:
      updater - the updater
      names - the names
    • getUpdaterNames

      public static Set<String> getUpdaterNames()
      Get the names of available updaters
      Returns:
      the names
    • updateProject

      public static UpdateBuilder updateProject(String project)
      Create the update process
      Parameters:
      project - the project
      Returns:
      the update process
    • version

      public UpdateBuilder version(String version)
      Set the version
      Parameters:
      version - the version
      Returns:
      the update process
    • outputFile

      public UpdateBuilder outputFile(File outputFile)
      Set the output file
      Parameters:
      outputFile - the output file
      Returns:
      the update process
    • outputFile

      public UpdateBuilder outputFile(String outputFile)
      Set the output file
      Parameters:
      outputFile - the output file
      Returns:
      the update process
    • workingDirectory

      public UpdateBuilder workingDirectory(File workingDirectory)
      Set the working directory
      Parameters:
      workingDirectory - the working directory
      Returns:
      the update process
    • workingDirectory

      public UpdateBuilder workingDirectory(String workingDirectory)
      Set the working directory
      Parameters:
      workingDirectory - the working directory
      Returns:
      the update process
    • checksumSupplier

      public UpdateBuilder checksumSupplier(UpdateBuilder.ChecksumSupplier checksumSupplier)
      Set the checksum supplier
      Parameters:
      checksumSupplier - the checksum supplier
      Returns:
      the update process
    • checksumConsumer

      public UpdateBuilder checksumConsumer(UpdateBuilder.ChecksumConsumer checksumConsumer)
      Set the checksum consumer
      Parameters:
      checksumConsumer - the checksum consumer
      Returns:
      the update process
    • debugConsumer

      public UpdateBuilder debugConsumer(DebugConsumer debugConsumer)
      Set the debug consumer
      Parameters:
      debugConsumer - the debug consumer
      Returns:
      the update process
    • checksumFile

      public UpdateBuilder checksumFile(File checksumFile)
      Set the checksum file
      Parameters:
      checksumFile - the checksum file
      Returns:
      the update process
    • checksumFile

      public UpdateBuilder checksumFile(String checksumFile)
      Set the checksum file
      Parameters:
      checksumFile - the checksum file
      Returns:
      the update process
    • checkOnly

      public UpdateBuilder checkOnly(boolean checkOnly)
      Set if the update process should only check the checksum
      Parameters:
      checkOnly - the check only
      Returns:
      the update process
    • userAgent

      public UpdateBuilder userAgent(String userAgent)
      Set the user agent for the update process
      Parameters:
      userAgent - the user agent string
      Returns:
      the update process
    • checksumConsumer

      public UpdateBuilder.ChecksumConsumer checksumConsumer()
      Get the checksum consumer
      Returns:
      the checksum consumer
    • checksumSupplier

      public UpdateBuilder.ChecksumSupplier checksumSupplier()
      Get the checksum supplier
      Returns:
      the checksum supplier
    • workingDirectory

      public File workingDirectory(boolean create)
      Get the working directory
      Parameters:
      create - if the directory should be created if it doesn't exist
      Returns:
      the working directory
    • workingDirectory

      public File workingDirectory()
      Get the working directory
      Returns:
      the working directory
    • debugConsumer

      public DebugConsumer debugConsumer()
      Get the debug consumer
      Returns:
      the debug consumer
    • userAgent

      public String userAgent()
      Get the user agent
      Returns:
      the user agent string
    • debug

      public void debug(String message)
      Debug a message
      Parameters:
      message - the message
    • executeAsync

      public CompletableFuture<UpdateStatus> executeAsync()
      Execute the update process
      Returns:
      the update status
    • execute

      Execute the update process
      Returns:
      the status of the process
      Throws:
      ExecutionException
      InterruptedException