Revert "Update ModrinthRemoteModRepository.java"

This reverts commit 40b7c1d59d.
This commit is contained in:
Tungstend 2022-06-01 23:45:31 +08:00
parent 4404daf0ea
commit 2027c9ef4c

View File

@ -79,9 +79,12 @@ public final class ModrinthRemoteModRepository implements RemoteModRepository {
if (StringUtils.isNotBlank(gameVersion)) {
facets.add(Collections.singletonList("versions:" + gameVersion));
}
/*
if (StringUtils.isNotBlank(category.getId())) {
facets.add(Collections.singletonList("categories:" + category.getId()));
}
*/
Map<String, String> query = mapOf(
pair("query", searchFilter),
pair("facets", JsonUtils.UGLY_GSON.toJson(facets)),
@ -135,8 +138,14 @@ public final class ModrinthRemoteModRepository implements RemoteModRepository {
}
public List<Category> getCategoriesImpl() throws IOException {
List<Category> reorganizedCategories = new ArrayList<>();
List<Category> categories = HttpRequest.GET(PREFIX + "/v2/tag/category").getJson(new TypeToken<List<Category>>() {}.getType());
return categories.stream().filter(category -> category.getProjectType().equals(projectType)).collect(Collectors.toList());
for (Category category : categories) {
if (category.getProjectType().equals(projectType)) {
reorganizedCategories.add(category);
}
}
return reorganizedCategories;
}
@Override