Skip to content

Commit 3c64a30

Browse files
committed
fix: 排序模组时应忽略大小写
1 parent 8c3d173 commit 3c64a30

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

FCL/src/main/java/com/tungsten/fcl/ui/manage/ModListPage.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ private CompletableFuture<?> loadMods(ModManager modManager) {
277277
synchronized (ModListPage.this) {
278278
setLoading(true);
279279
modManager.refreshMods();
280-
return new ArrayList<>(modManager.getMods());
280+
return modManager.getMods().stream().map(it -> new ModInfoObject(getContext(), it)).collect(Collectors.toList());
281281
}
282282
} catch (IOException e) {
283283
throw new UncheckedIOException(e);
@@ -286,10 +286,10 @@ private CompletableFuture<?> loadMods(ModManager modManager) {
286286
setLoading(false);
287287
if (exception == null)
288288
try {
289-
itemsProperty.setAll(list.stream().map(it -> new ModInfoObject(getContext(), it)).filter(modInfoObject -> {
289+
itemsProperty.setAll(list.stream().filter(modInfoObject -> {
290290
boolean active = modInfoObject.getModInfo().isActive();
291291
return (enabled.isChecked() && active) || (disabled.isChecked() && !active);
292-
}).sorted().collect(Collectors.toList()));
292+
}).collect(Collectors.toList()));
293293
} catch (Throwable e) {
294294
LOG.log(Level.SEVERE, "Failed to load local mod list", e);
295295
}
@@ -500,7 +500,7 @@ private void search() {
500500
}
501501
}
502502

503-
public static class ModInfoObject implements Comparable<ModInfoObject> {
503+
public static class ModInfoObject {
504504
private final BooleanProperty active;
505505
private final LocalModFile localModFile;
506506
private final String title;
@@ -547,11 +547,6 @@ public ModTranslations.Mod getMod() {
547547
return mod;
548548
}
549549

550-
@Override
551-
public int compareTo(@NotNull ModInfoObject o) {
552-
return localModFile.getFileName().toLowerCase().compareTo(o.localModFile.getFileName().toLowerCase());
553-
}
554-
555550
public RemoteMod getRemoteMod() {
556551
return remoteMod;
557552
}

FCLCore/src/main/java/com/tungsten/fclcore/mod/LocalModFile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public ModUpdate checkUpdates(String gameVersion, RemoteModRepository repository
186186

187187
@Override
188188
public int compareTo(LocalModFile o) {
189-
return getFileName().compareTo(o.getFileName());
189+
return getFileName().compareToIgnoreCase(o.getFileName());
190190
}
191191

192192
@Override

0 commit comments

Comments
 (0)