Skip to content

Commit 9716359

Browse files
committed
move getExpansionCount to metrics
1 parent 518b295 commit 9716359

2 files changed

Lines changed: 7 additions & 12 deletions

File tree

src/main/java/me/hsgamer/bettergui/BetterGUI.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
import org.bukkit.plugin.java.JavaPlugin;
2626

2727
import java.util.Arrays;
28+
import java.util.HashMap;
2829
import java.util.List;
30+
import java.util.Map;
2931

3032
/**
3133
* The main class of the plugin
@@ -94,7 +96,11 @@ public void postEnable() {
9496
get(AddonManager.class).call(PostEnable.class, PostEnable::postEnable);
9597

9698
Metrics metrics = new Metrics(this, 6609);
97-
metrics.addCustomChart(new AdvancedPie("addon_count", get(AddonManager.class)::getExpansionCount));
99+
metrics.addCustomChart(new AdvancedPie("addon_count", () -> {
100+
Map<String, Integer> map = new HashMap<>();
101+
get(AddonManager.class).getEnabledExpansions().keySet().forEach(s -> map.put(s, 1));
102+
return map;
103+
}));
98104

99105
if (getDescription().getVersion().contains("SNAPSHOT")) {
100106
getLogger().warning("You are using the development version");

src/main/java/me/hsgamer/bettergui/manager/AddonManager.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,6 @@ private void checkPluginDepends(@NotNull ExpansionClassLoader loader) {
9292
}
9393
}
9494

95-
/**
96-
* Get expansion count
97-
*
98-
* @return the expansion count
99-
*/
100-
public Map<String, Integer> getExpansionCount() {
101-
Map<String, Integer> map = new HashMap<>();
102-
getEnabledExpansions().keySet().forEach(s -> map.put(s, 1));
103-
return map;
104-
}
105-
10695
/**
10796
* Get the plugin
10897
*

0 commit comments

Comments
 (0)