49 lines
1.3 KiB
Java
49 lines
1.3 KiB
Java
package io.gitlab.jfronny.inceptum.launcher.system.mds;
|
|
|
|
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.InstanceMeta;
|
|
import io.gitlab.jfronny.inceptum.launcher.system.instance.Instance;
|
|
import io.gitlab.jfronny.inceptum.launcher.system.instance.Mod;
|
|
import io.gitlab.jfronny.inceptum.launcher.system.mds.noop.NoopMds;
|
|
|
|
import java.io.Closeable;
|
|
import java.io.IOException;
|
|
import java.nio.file.Files;
|
|
import java.nio.file.Path;
|
|
import java.util.Set;
|
|
import java.util.function.BiConsumer;
|
|
|
|
public interface ModsDirScanner extends Closeable {
|
|
static ModsDirScanner get(Path modsDir, InstanceMeta meta) throws IOException {
|
|
if (Files.exists(modsDir)) return ModsDirScannerImpl.get(modsDir, meta);
|
|
return new NoopMds(meta.getMinecraftVersion());
|
|
}
|
|
|
|
static void closeAll() {
|
|
ModsDirScannerImpl.closeAll();
|
|
}
|
|
|
|
boolean isComplete();
|
|
|
|
void start();
|
|
|
|
String getGameVersion();
|
|
|
|
Set<Mod> getMods() throws IOException;
|
|
|
|
Mod get(Path path);
|
|
|
|
void invalidate(Path path);
|
|
|
|
default void invalidate(Mod mod) {
|
|
invalidate(mod.getMetadataPath());
|
|
}
|
|
|
|
boolean hasScanned(Path path);
|
|
|
|
default boolean hasScanned(Mod mod) {
|
|
return hasScanned(mod.getMetadataPath());
|
|
}
|
|
|
|
void runOnce(BiConsumer<Path, Mod> discovered);
|
|
}
|