Class ModDownloaderStrategy<M extends Mod>

java.lang.Object
wtf.ranked.hytale.server.runner.mod.strategy.ModDownloaderStrategy<M>
Type Parameters:
M - the specific type of Mod this strategy handles
All Implemented Interfaces:
org.gradle.workers.WorkAction<ModDownloaderStrategy.ModDownloaderExtension>
Direct Known Subclasses:
UrlDownloaderStrategy

public abstract class ModDownloaderStrategy<M extends Mod> extends Object implements org.gradle.workers.WorkAction<ModDownloaderStrategy.ModDownloaderExtension>
Base strategy for downloading and installing Hytale mods.

As a BuildService, it has access to global project parameters. It enforces a "check-before-download" workflow to ensure mods are only fetched if they are missing from the local environment.

  • Constructor Details

    • ModDownloaderStrategy

      public ModDownloaderStrategy()
  • Method Details

    • execute

      public final void execute() throws ResourceDownloadException

      This method is marked final to ensure the "check-before-download" workflow remains consistent across all strategy implementations.

      Specified by:
      execute in interface org.gradle.workers.WorkAction<M extends Mod>
      Throws:
      ResourceDownloadException
    • isModInstalled

      protected boolean isModInstalled(@NonNull String identifier)
      Checks if a mod is already present in the local mods directory.
      Parameters:
      identifier - the file name or identifier of the mod to check
      Returns:
      true if the mod file exists on disk, false otherwise
    • download

      protected abstract void download(@NonNull M mod)
      Implementation-specific logic to acquire the mod file.
      Parameters:
      mod - the mod definition