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 @@ -280,7 +280,7 @@ public final void markDirty() {
return Optional.empty();
}

private int countNonEmptyResearches(@Nonnull Collection<Research> researches) {
public int countNonEmptyResearches(@Nonnull Collection<Research> researches) {
int count = 0;
for (Research research : researches) {
if (research.hasEnabledItems()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ public String onRequest(@Nullable OfflinePlayer p, @Nonnull String params) {
Optional<PlayerProfile> profile = PlayerProfile.find(p);

if (profile.isPresent()) {
Set<Research> set = profile.get().getResearches();
return String.valueOf(Math.round(((set.size() * 100.0F) / Slimefun.getRegistry().getResearches().size()) * 100.0F) / 100.0F);
int unlockedResearches = profile.get().countNonEmptyResearches(profile.get().getResearches());
int allResearches = profile.get().countNonEmptyResearches(Slimefun.getRegistry().getResearches());
return String.valueOf(Math.round(((unlockedResearches * 100.0F) / allResearches) * 100.0F) / 100.0F);
} else if (p instanceof Player player) {
return getProfilePlaceholder(player);
}
Expand Down
Loading