Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ public abstract class LocalizedRemoteAddonRepository implements RemoteAddonRepos

protected abstract RemoteAddonRepository getBackedRemoteModRepository();

protected abstract SortType getBackedRemoteModRepositorySortOrder();

@Override
public String getApiBaseUrl() {
return getBackedRemoteModRepository().getApiBaseUrl();
Expand Down Expand Up @@ -80,8 +78,8 @@ public SearchResult search(DownloadProvider downloadProvider, String gameVersion
SearchResult searchResult = null;
List<RemoteAddon> remoteAddons = List.of();
for (String englishSearchFilter : englishSearchFiltersSet) {
searchResult = getBackedRemoteModRepository().search(downloadProvider, gameVersion, category, pageOffset, pageSize, englishSearchFilter, getBackedRemoteModRepositorySortOrder(), sortOrder);
remoteAddons = searchResult.getUnsortedResults().toList();
searchResult = getBackedRemoteModRepository().search(downloadProvider, gameVersion, category, pageOffset, pageSize, englishSearchFilter, SortType.RELEVANCY, sortOrder);
remoteAddons = searchResult.results().toList();
if (!remoteAddons.isEmpty()) {
break;
}
Expand All @@ -100,7 +98,7 @@ public SearchResult search(DownloadProvider downloadProvider, String gameVersion
searchResultArray[englishIndex--] = remoteAddon;
}
}
totalPages = searchResult.getTotalPages();
totalPages = searchResult.totalPages();
}

StringUtils.LevCalculator levCalculator = new StringUtils.LevCalculator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ private void search(String userGameVersion, RemoteAddonRepository.Category categ

setLoading(false);
if (exception == null) {
items.setAll(result.getResults().collect(Collectors.toList()));
pageCount.set(result.getTotalPages());
items.setAll(result.results().collect(Collectors.toList()));
pageCount.set(result.totalPages());
failed.set(false);
} else {
failed.set(true);
Expand Down Expand Up @@ -370,7 +370,7 @@ protected ModDownloadListPageSkin(DownloadListPage control) {
sortStackPane.getChildren().setAll(sortComboBox);
sortComboBox.prefWidthProperty().bind(sortStackPane.widthProperty());
sortComboBox.getStyleClass().add("fit-width");
sortComboBox.setConverter(stringConverter(sortType -> i18n("curse.sort." + sortType.name().toLowerCase(Locale.ROOT))));
sortComboBox.setConverter(stringConverter(sortType -> i18n("addon.sort." + sortType.name().toLowerCase(Locale.ROOT))));
sortComboBox.getItems().setAll(RemoteAddonRepository.SortType.values());
sortComboBox.getSelectionModel().select(0);
searchPane.addRow(rowIndex++, new Label(i18n("addon.category")), categoryStackPane, new Label(i18n("search.sort")), sortStackPane);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,6 @@ protected RemoteAddonRepository getBackedRemoteModRepository() {
}
}

@Override
protected SortType getBackedRemoteModRepositorySortOrder() {
if ("addon.modrinth".equals(downloadSource.get())) {
return SortType.NAME;
} else {
return SortType.POPULARITY;
}
}

@Override
public RemoteAddon.Type getType() {
return type;
Expand Down
12 changes: 5 additions & 7 deletions HMCL/src/main/resources/assets/lang/I18N.properties
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ addon.download.recommend=Recommended Version for Minecraft %1s
addon.download.title.release=Minecraft %s
addon.download.title.snapshot=Minecraft %s (Snapshots)
addon.modrinth=Modrinth
addon.sort.date_created=Date Created
addon.sort.last_updated=Last Updated
addon.sort.popularity=Popularity
addon.sort.relevancy=Relevancy
addon.sort.total_downloads=Total Downloads

archive.author=Author(s)
archive.date=Publish Date
Expand Down Expand Up @@ -384,13 +389,6 @@ curse.category.6553=Realistic
curse.category.6554=Fantasy
curse.category.6555=Vanilla

curse.sort.author=Author
curse.sort.date_created=Date Created
curse.sort.last_updated=Last Updated
curse.sort.name=Name
curse.sort.popularity=Popularity
curse.sort.total_downloads=Total Downloads

datetime.format=MMM d, yyyy, h\:mm\:ss a

download=Download
Expand Down
11 changes: 4 additions & 7 deletions HMCL/src/main/resources/assets/lang/I18N_ar.properties
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ addon.check_update.source=المصدر
addon.check_update.target_version=الإصدار المستهدف
addon.curseforge=CurseForge
addon.modrinth=Modrinth
addon.sort.date_created=تاريخ الإنشاء
addon.sort.last_updated=آخر تحديث
addon.sort.popularity=الشعبية
addon.sort.total_downloads=إجمالي التنزيلات

archive.author=المؤلف/المؤلفون
archive.date=تاريخ النشر
Expand Down Expand Up @@ -354,13 +358,6 @@ curse.category.4550=مهام
curse.category.4555=توليد العالم
curse.category.4552=سكريبتات

curse.sort.author=المؤلف
curse.sort.date_created=تاريخ الإنشاء
curse.sort.last_updated=آخر تحديث
curse.sort.name=الاسم
curse.sort.popularity=الشعبية
curse.sort.total_downloads=إجمالي التنزيلات

datetime.format=MMM d, yyyy, h\:mm\:ss a

download=تنزيل
Expand Down
11 changes: 4 additions & 7 deletions HMCL/src/main/resources/assets/lang/I18N_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ addon.check_update.target_version=Versión de destino
addon.curseforge=CurseForge
addon.download.recommend=Versión recomendada - Minecraft %1s
addon.modrinth=Modrinth
addon.sort.date_created=Fecha de creación
addon.sort.last_updated=Última actualización
addon.sort.popularity=Popularidad
addon.sort.total_downloads=Descargas totales

archive.author=Autor(es)
archive.date=Fecha de publicación
Expand Down Expand Up @@ -334,13 +338,6 @@ curse.category.4550=Quests
curse.category.4555=Generación del mundo
curse.category.4552=Scripts

curse.sort.author=Autor
curse.sort.date_created=Fecha de creación
curse.sort.last_updated=Última actualización
curse.sort.name=Nombre
curse.sort.popularity=Popularidad
curse.sort.total_downloads=Descargas totales

datetime.format=d MMM yyyy, H\:mm\:ss

download=Descargar
Expand Down
11 changes: 4 additions & 7 deletions HMCL/src/main/resources/assets/lang/I18N_ja.properties
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ addon.check_update.source=Source
addon.check_update.target_version=Target
addon.curseforge=CurseForge
addon.modrinth=Modrinth
addon.sort.date_created=作成日
addon.sort.last_updated=最終更新
addon.sort.popularity=人気
addon.sort.total_downloads=合計ダウンロード数

archive.author=作成者
archive.date=公開日
Expand Down Expand Up @@ -287,13 +291,6 @@ curse.category.4550=クエスト
curse.category.4555=World Gen
curse.category.4552=スクリプト

curse.sort.author=Author
curse.sort.date_created=作成日
curse.sort.last_updated=最終更新
curse.sort.name=名前
curse.sort.popularity=人気
curse.sort.total_downloads=合計ダウンロード数

datetime.format=yyyy/MM/dd H:mm:ss

download=ダウンロード
Expand Down
11 changes: 4 additions & 7 deletions HMCL/src/main/resources/assets/lang/I18N_lzh.properties
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ addon.check_update.target_version=將至之版
addon.curseforge=CurseForge
addon.download.recommend=宜版 - 礦藝 %1s
addon.modrinth=Modrinth
addon.sort.date_created=創立之期
addon.sort.last_updated=近日迭更
addon.sort.popularity=幾熱
addon.sort.total_downloads=引數

archive.author=作者
archive.date=廣佈之期
Expand Down Expand Up @@ -333,13 +337,6 @@ curse.category.4550=任務
curse.category.4555=生界新創
curse.category.4552=角本

curse.sort.author=作者
curse.sort.date_created=創立之期
curse.sort.last_updated=近日迭更
curse.sort.name=名
curse.sort.popularity=幾熱
curse.sort.total_downloads=引數

datetime.format=yyyy 年 MM 月 dd 日 HH:mm:ss

download=引
Expand Down
11 changes: 4 additions & 7 deletions HMCL/src/main/resources/assets/lang/I18N_ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ addon.check_update.source=Источник
addon.check_update.target_version=Целевая версия
addon.curseforge=CurseForge
addon.modrinth=Modrinth
addon.sort.date_created=Создан
addon.sort.last_updated=Обновлён
addon.sort.popularity=Популярность
addon.sort.total_downloads=Скачиваний

archive.author=Автор(ы)
archive.date=Дата публикации
Expand Down Expand Up @@ -330,13 +334,6 @@ curse.category.4550=Квесты
curse.category.4555=Генерация карты
curse.category.4552=Скрипты

curse.sort.author=Автор
curse.sort.date_created=Создан
curse.sort.last_updated=Обновлён
curse.sort.name=Название
curse.sort.popularity=Популярность
curse.sort.total_downloads=Скачиваний

datetime.format=d MMM yyyy г., HH\:mm\:ss

download=Скачать
Expand Down
11 changes: 4 additions & 7 deletions HMCL/src/main/resources/assets/lang/I18N_uk.properties
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ addon.check_update.source=Джерело
addon.check_update.target_version=Цільова версія
addon.curseforge=CurseForge
addon.modrinth=Modrinth
addon.sort.date_created=Дата створення
addon.sort.last_updated=Останнє оновлення
addon.sort.popularity=Популярність
addon.sort.total_downloads=Всього завантажень

archive.author=Автор(и)
archive.date=Дата публікації
Expand Down Expand Up @@ -330,13 +334,6 @@ curse.category.4550=Квести
curse.category.4555=Генерація світу
curse.category.4552=Скрипти

curse.sort.author=Автор
curse.sort.date_created=Дата створення
curse.sort.last_updated=Останнє оновлення
curse.sort.name=Назва
curse.sort.popularity=Популярність
curse.sort.total_downloads=Всього завантажень

datetime.format=dd.MM.yyyy, HH:mm:ss

download=Завантажити
Expand Down
12 changes: 5 additions & 7 deletions HMCL/src/main/resources/assets/lang/I18N_zh.properties
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ addon.download.recommend=推薦版本 - Minecraft %1s
addon.download.title.release=Minecraft %s
addon.download.title.snapshot=Minecraft %s (快照)
addon.modrinth=Modrinth
addon.sort.date_created=建立日期
addon.sort.last_updated=最近更新
addon.sort.popularity=熱度
addon.sort.relevancy=相關度
addon.sort.total_downloads=下載量

archive.author=作者
archive.date=發布日期
Expand Down Expand Up @@ -382,13 +387,6 @@ curse.category.6553=寫實
curse.category.6554=幻想
curse.category.6555=原生

curse.sort.author=作者
curse.sort.date_created=建立日期
curse.sort.last_updated=最近更新
curse.sort.name=名稱
curse.sort.popularity=熱度
curse.sort.total_downloads=下載量

datetime.format=yyyy 年 MM 月 dd 日 HH:mm:ss

download=下載
Expand Down
12 changes: 5 additions & 7 deletions HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ addon.download.recommend=推荐版本 - Minecraft %1s
addon.download.title.release=Minecraft %s
addon.download.title.snapshot=Minecraft %s (快照)
addon.modrinth=Modrinth
addon.sort.date_created=创建日期
addon.sort.last_updated=最近更新
addon.sort.popularity=热度
addon.sort.relevancy=相关度
addon.sort.total_downloads=下载量

archive.author=作者
archive.date=发布日期
Expand Down Expand Up @@ -384,13 +389,6 @@ curse.category.6553=写实
curse.category.6554=幻想
curse.category.6555=原生

curse.sort.author=作者
curse.sort.date_created=创建日期
curse.sort.last_updated=最近更新
curse.sort.name=名称
curse.sort.popularity=热度
curse.sort.total_downloads=下载量

datetime.format=yyyy 年 MM 月 dd 日 HH:mm:ss

download=下载
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,52 +35,6 @@ public interface RemoteAddonRepository {

String getBaseUrl();

enum SortType {
POPULARITY,
NAME,
DATE_CREATED,
LAST_UPDATED,
AUTHOR,
TOTAL_DOWNLOADS
}

enum SortOrder {
ASC,
DESC
}

class SearchResult {
private final Stream<RemoteAddon> sortedResults;

private final Stream<RemoteAddon> unsortedResults;

private final int totalPages;

public SearchResult(Stream<RemoteAddon> sortedResults, Stream<RemoteAddon> unsortedResults, int totalPages) {
this.sortedResults = sortedResults;
this.unsortedResults = unsortedResults;
this.totalPages = totalPages;
}

public SearchResult(Stream<RemoteAddon> sortedResults, int pages) {
this.sortedResults = sortedResults;
this.unsortedResults = sortedResults;
this.totalPages = pages;
}

public Stream<RemoteAddon> getResults() {
return this.sortedResults;
}

public Stream<RemoteAddon> getUnsortedResults() {
return this.unsortedResults;
}

public int getTotalPages() {
return this.totalPages;
}
}

SearchResult search(DownloadProvider downloadProvider, String gameVersion, @Nullable Category category, int pageOffset, int pageSize, String searchFilter, SortType sortType, SortOrder sortOrder)
throws IOException;

Expand All @@ -106,4 +60,20 @@ default RemoteAddon resolveDependency(DownloadProvider downloadProvider, String

record Category(Object self, String id, List<Category> subcategories) {
}

enum SortType {
RELEVANCY,
POPULARITY,
DATE_CREATED,
LAST_UPDATED,
TOTAL_DOWNLOADS
}

enum SortOrder {
ASC,
DESC
}

record SearchResult(Stream<RemoteAddon> results, int totalPages) {
}
}
Loading