Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove sorting of individual contributors #726

Merged
merged 1 commit into from
Jun 15, 2024
Merged
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
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
Loading