Skip to content

Commit

Permalink
Fix merge derp in AbstractModProvider and logic derp in ModDiscoverer
Browse files Browse the repository at this point in the history
Signed-off-by: cpw <[email protected]>
  • Loading branch information
cpw committed Jun 20, 2022
1 parent 7bb97da commit d5860d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ protected IModLocator.ModFileOrException createMod(Path... path) {
} else if (type != null) {
LOGGER.debug(LogMarkers.SCAN, "Found {} mod of type {}: {}", MANIFEST, type, path);
mod = new ModFile(sj, this, this::manifestParser, type);
} else {
return new IModLocator.ModFileOrException(null, new ModFileLoadingException("Invalid mod file found "+ Arrays.toString(path)));
} catch (InvalidModFileException e) {
return new IModLocator.ModFileOrException(null, e);
} else {
return new IModLocator.ModFileOrException(null, new ModFileLoadingException("Invalid mod file found "+ Arrays.toString(path)));
}

mjm.setModFile(mod);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ public ModValidator discoverMods() {
LOGGER.debug(LogMarkers.SCAN, "Locator {} found {} invalid mod files", locator, exceptions.size());
brokenFiles.addAll(exceptions.stream().map(e->e instanceof InvalidModFileException ime ? ime.getBrokenFile() : null).filter(Objects::nonNull).toList());
}
var locatedFiles = candidates.stream().map(IModLocator.ModFileOrException::file).filter(Objects::nonNull).toList();
var locatedFiles = candidates.stream().map(IModLocator.ModFileOrException::file).filter(Objects::nonNull).collect(Collectors.toList());

var badModFiles = locatedFiles.stream().filter(file -> !(file instanceof ModFile)).toList();
if (!badModFiles.isEmpty()) {
LOGGER.error(LogMarkers.SCAN, "Locator {} returned {} files which is are not ModFile instances! They will be skipped!", locator, badModFiles.size());
brokenFiles.addAll(badModFiles.stream().map(mf->mf.getModFileInfo()).toList());
brokenFiles.addAll(badModFiles.stream().map(IModFile::getModFileInfo).toList());
}
locatedFiles.removeAll(badModFiles);
LOGGER.debug(LogMarkers.SCAN, "Locator {} found {} valid mod files", locator, locatedFiles.size());
Expand Down

0 comments on commit d5860d7

Please sign in to comment.