Switch blacklist stat to entry counts.

This commit is contained in:
wizjany 2019-11-10 01:31:55 -05:00
parent 2c14acc28c
commit 87162acf11

View File

@ -228,23 +228,21 @@ private void setupCustomCharts(Metrics metrics) {
return driver instanceof DirectoryYamlDriver ? "yaml" : driver instanceof SQLDriver ? "sql" : "unknown";
}));
metrics.addCustomChart(new Metrics.SimpleBarChart("blacklist", () -> {
int unused = 0;
int standard = 0;
int whitelist = 0;
int blacklisted = 0;
int whitelisted = 0;
for (BukkitWorldConfiguration worldConfig : platform.getGlobalStateManager().getWorldConfigs()) {
Blacklist blacklist = worldConfig.getBlacklist();
if (blacklist == null || blacklist.isEmpty()) {
unused++;
continue;
} else if (blacklist.isWhitelist()) {
whitelist++;
whitelisted += blacklist.getItemCount();
} else {
standard++;
blacklisted += blacklist.getItemCount();
}
}
Map<String, Integer> blacklistCounts = new HashMap<>();
blacklistCounts.put("unused", unused);
blacklistCounts.put("blacklist", standard);
blacklistCounts.put("whitelist", whitelist);
blacklistCounts.put("blacklist", blacklisted);
blacklistCounts.put("whitelist", whitelisted);
return blacklistCounts;
}));
metrics.addCustomChart(new Metrics.SimplePie("chest_protection", () ->