Skip to content

Commit

Permalink
Remove sorting of individual contributors (#726)
Browse files Browse the repository at this point in the history
- Fixed contributors being sorted
  • Loading branch information
LostLuma authored Jun 15, 2024
1 parent 5963bc0 commit 22e42d3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/terraformersmc/modmenu/util/mod/Mod.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ default String getTranslatedDescription() {
* @return a mapping of roles to each contributor with that role.
*/
@NotNull
SortedMap<String, SortedSet<String>> getCredits();
SortedMap<String, Set<String>> getCredits();

@NotNull
Set<Badge> getBadges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public FabricDummyParentMod(FabricMod host, String id) {
}

@Override
public @NotNull SortedMap<String, SortedSet<String>> getCredits() {
public @NotNull SortedMap<String, Set<String>> getCredits() {
return new TreeMap<>();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public FabricMod(ModContainer modContainer, Set<String> modpackMods) {

@Override
public @NotNull Map<String, Collection<String>> getContributors() {
Map<String, Collection<String>> contributors = new HashMap<>();
Map<String, Collection<String>> contributors = new LinkedHashMap<>();

for (var contributor : this.metadata.getContributors()) {
contributors.put(contributor.getName(), List.of("Contributor"));
Expand All @@ -222,8 +222,8 @@ public FabricMod(ModContainer modContainer, Set<String> modpackMods) {
}

@Override
public @NotNull SortedMap<String, SortedSet<String>> getCredits() {
SortedMap<String, SortedSet<String>> credits = new TreeMap<>();
public @NotNull SortedMap<String, Set<String>> getCredits() {
SortedMap<String, Set<String>> credits = new TreeMap<>();

var authors = this.getAuthors();
var contributors = this.getContributors();
Expand All @@ -234,7 +234,7 @@ public FabricMod(ModContainer modContainer, Set<String> modpackMods) {

for (var contributor : contributors.entrySet()) {
for (var role : contributor.getValue()) {
credits.computeIfAbsent(role, key -> new TreeSet<>(String.CASE_INSENSITIVE_ORDER));
credits.computeIfAbsent(role, key -> new LinkedHashSet<>());
credits.get(role).add(contributor.getKey());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.stream.Collectors;

public class QuiltMod extends FabricMod {
Expand Down Expand Up @@ -60,7 +59,7 @@ public QuiltMod(net.fabricmc.loader.api.ModContainer fabricModContainer, Set<Str

@Override
public @NotNull Map<String, Collection<String>> getContributors() {
Map<String, Collection<String>> contributors = new HashMap<>();
Map<String, Collection<String>> contributors = new LinkedHashMap<>();

for (var contributor : this.metadata.contributors()) {
contributors.put(contributor.name(), contributor.roles());
Expand All @@ -70,14 +69,14 @@ public QuiltMod(net.fabricmc.loader.api.ModContainer fabricModContainer, Set<Str
}

@Override
public @NotNull SortedMap<String, SortedSet<String>> getCredits() {
SortedMap<String, SortedSet<String>> credits = new TreeMap<>();
public @NotNull SortedMap<String, Set<String>> getCredits() {
SortedMap<String, Set<String>> credits = new TreeMap<>();

var contributors = this.getContributors();

for (var contributor : contributors.entrySet()) {
for (var role : contributor.getValue()) {
credits.computeIfAbsent(role, key -> new TreeSet<>(String.CASE_INSENSITIVE_ORDER));
credits.computeIfAbsent(role, key -> new LinkedHashSet<>());
credits.get(role).add(contributor.getKey());
}
}
Expand Down

0 comments on commit 22e42d3

Please sign in to comment.