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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceParameters for the mod downloader work action. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidImplementation-specific logic to acquire the mod file.final voiddownloadMod(@NonNull M mod) Orchestrates the installation of a mod.voidexecute()protected booleanisModInstalled(@NonNull String identifier) Checks if a mod is already present in the local mods directory.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gradle.workers.WorkAction
getParameters
-
Constructor Details
-
ModDownloaderStrategy
public ModDownloaderStrategy()
-
-
Method Details
-
execute
This method is marked final to ensure the "check-before-download" workflow remains consistent across all strategy implementations.
- Specified by:
executein interfaceorg.gradle.workers.WorkAction<M extends Mod>- Throws:
ResourceDownloadException
-
downloadMod
Orchestrates the installation of a mod. Checks for the mod's existence on disk before triggering the implementation-specificdownload(Mod)method.- Parameters:
mod- the mod definition to process- Throws:
ResourceDownloadException
-
isModInstalled
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:
trueif the mod file exists on disk,falseotherwise
-
download
Implementation-specific logic to acquire the mod file.- Parameters:
mod- the mod definition
-