diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerProfile.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerProfile.java index 8dfc7414f8..5c430521ab 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerProfile.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerProfile.java @@ -280,7 +280,7 @@ public final void markDirty() { return Optional.empty(); } - private int countNonEmptyResearches(@Nonnull Collection researches) { + public int countNonEmptyResearches(@Nonnull Collection researches) { int count = 0; for (Research research : researches) { if (research.hasEnabledItems()) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/PlaceholderAPIIntegration.java b/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/PlaceholderAPIIntegration.java index 826fb1e4b5..1ec0497d63 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/PlaceholderAPIIntegration.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/PlaceholderAPIIntegration.java @@ -106,8 +106,9 @@ public String onRequest(@Nullable OfflinePlayer p, @Nonnull String params) { Optional profile = PlayerProfile.find(p); if (profile.isPresent()) { - Set 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); }