Fix custom charts

Probably
This commit is contained in:
Norbi Peti 2021-02-21 02:15:10 +01:00
parent 12a8ccf3ce
commit d46adfd957
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56

View file

@ -5,7 +5,7 @@ import de.jaschastarke.modularize.IModule;
import de.jaschastarke.modularize.ModuleEntry;
import de.jaschastarke.modularize.ModuleEntry.ModuleState;
import org.bstats.bukkit.Metrics;
import org.bstats.charts.MultiLineChart;
import org.bstats.charts.AdvancedPie;
import org.bukkit.event.Listener;
import java.util.HashMap;
@ -23,14 +23,14 @@ public class FeatureMetrics extends CoreModule<LimitedCreative> implements Liste
if (bstats == null) {
bstats = new Metrics(plugin, 10413);
bstats.addCustomChart(new MultiLineChart("Module Usage", () -> {
bstats.addCustomChart(new AdvancedPie("module_usage", () -> {
HashMap<String, Integer> ret = new HashMap<>();
for (final ModuleEntry<IModule> mod : plugin.getModules())
if (mod.getModule() instanceof CoreModule<?>)
ret.put(((CoreModule<?>) mod.getModule()).getName(), mod.getState() == ModuleState.ENABLED ? 1 : 0);
return ret;
}));
bstats.addCustomChart(new MultiLineChart("Dependencies", () -> {
bstats.addCustomChart(new AdvancedPie("dependencies", () -> {
HashMap<String, Integer> ret = new HashMap<>();
for (final String dep : plugin.getDescription().getSoftDepend())
ret.put(dep, plugin.getServer().getPluginManager().isPluginEnabled(dep) ? 1 : 0);