public class DownloadingPackFinder extends java.lang.Object implements IPackFinder
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.CompletableFuture<?> |
currentDownload |
private java.util.concurrent.locks.ReentrantLock |
lockDownload |
private static org.apache.logging.log4j.Logger |
LOGGER |
private static java.util.regex.Pattern |
PATTERN_SHA1 |
private ResourceIndex |
resourceIndex |
private ClientResourcePackInfo |
serverPack |
private java.io.File |
serverPackDir |
private VanillaPack |
vanillaPack |
Constructor and Description |
---|
DownloadingPackFinder(java.io.File serverPackDirIn,
ResourceIndex resourceIndexIn) |
Modifier and Type | Method and Description |
---|---|
<T extends ResourcePackInfo> |
addPackInfosToMap(java.util.Map<java.lang.String,T> nameToPackMap,
ResourcePackInfo.IFactory<T> packInfoFactory) |
private boolean |
checkHash(java.lang.String expectedHash,
java.io.File fileIn) |
private void |
clearDownloads() |
void |
clearResourcePack() |
private static void |
deleteQuiet(java.io.File fileIn) |
java.util.concurrent.CompletableFuture<?> |
downloadResourcePack(java.lang.String url,
java.lang.String hash) |
static java.util.Map<java.lang.String,java.lang.String> |
getPackDownloadRequestProperties() |
VanillaPack |
getVanillaPack() |
java.util.concurrent.CompletableFuture<java.lang.Void> |
setServerPack(java.io.File fileIn) |
private static final org.apache.logging.log4j.Logger LOGGER
private static final java.util.regex.Pattern PATTERN_SHA1
private final VanillaPack vanillaPack
private final java.io.File serverPackDir
private final java.util.concurrent.locks.ReentrantLock lockDownload
private final ResourceIndex resourceIndex
@Nullable private java.util.concurrent.CompletableFuture<?> currentDownload
@Nullable private ClientResourcePackInfo serverPack
public DownloadingPackFinder(java.io.File serverPackDirIn, ResourceIndex resourceIndexIn)
public <T extends ResourcePackInfo> void addPackInfosToMap(java.util.Map<java.lang.String,T> nameToPackMap, ResourcePackInfo.IFactory<T> packInfoFactory)
addPackInfosToMap
in interface IPackFinder
public VanillaPack getVanillaPack()
public static java.util.Map<java.lang.String,java.lang.String> getPackDownloadRequestProperties()
public java.util.concurrent.CompletableFuture<?> downloadResourcePack(java.lang.String url, java.lang.String hash)
private static void deleteQuiet(java.io.File fileIn)
public void clearResourcePack()
private boolean checkHash(java.lang.String expectedHash, java.io.File fileIn)
private void clearDownloads()
public java.util.concurrent.CompletableFuture<java.lang.Void> setServerPack(java.io.File fileIn)