Skip to content
Permalink
Browse files

Switch blacklist to drilldown since bstats doesn't support bar charts.

See Bastian/bStats#67

Also update blacklist example txt with correct names.
  • Loading branch information
wizjany committed Nov 17, 2019
1 parent c413cf4 commit 1fd94a3655b6215d7dd35ab29caee1d37ae153fc
@@ -227,22 +227,27 @@ private void setupCustomCharts(Metrics metrics) {
RegionDriver driver = platform.getGlobalStateManager().selectedRegionStoreDriver;
return driver instanceof DirectoryYamlDriver ? "yaml" : driver instanceof SQLDriver ? "sql" : "unknown";
}));
metrics.addCustomChart(new Metrics.SimpleBarChart("blacklist", () -> {
int blacklisted = 0;
int whitelisted = 0;
metrics.addCustomChart(new Metrics.DrilldownPie("blacklist", () -> {
int empty = 0;
Map<String, Integer> blacklistMap = new HashMap<>();
Map<String, Integer> whitelistMap = new HashMap<>();
for (BukkitWorldConfiguration worldConfig : platform.getGlobalStateManager().getWorldConfigs()) {
Blacklist blacklist = worldConfig.getBlacklist();
if (blacklist != null && !blacklist.isEmpty()) {
if (blacklist.isWhitelist()) {
whitelisted += blacklist.getItemCount();
} else {
blacklisted += blacklist.getItemCount();
}
Map<String, Integer> target = blacklist.isWhitelist() ? whitelistMap : blacklistMap;
int floor = ((blacklist.getItemCount() - 1) / 10) * 10;
String range = floor >= 100 ? "101+" : (floor + 1) + " - " + (floor + 10);
target.merge(range, 1, Integer::sum);
} else {
empty++;
}
}
Map<String, Integer> blacklistCounts = new HashMap<>();
blacklistCounts.put("blacklist", blacklisted);
blacklistCounts.put("whitelist", whitelisted);
Map<String, Map<String, Integer>> blacklistCounts = new HashMap<>();
Map<String, Integer> emptyMap = new HashMap<>();
emptyMap.put("empty", empty);
blacklistCounts.put("empty", emptyMap);
blacklistCounts.put("blacklist", blacklistMap);
blacklistCounts.put("whitelist", whitelistMap);
return blacklistCounts;
}));
metrics.addCustomChart(new Metrics.SimplePie("chest_protection", () ->
@@ -7,7 +7,7 @@
###############################################################################
#
# Example to block some ore mining and placement:
# [coalore,goldore,ironore]
# [coal_ore,gold_ore,iron_ore]
# on-break=deny,log,kick
# on-place=deny,tell
#
@@ -51,17 +51,12 @@
#

# Deny lava buckets
#[lavabucket]
#[lava_bucket]
#ignore-perms=my.own.madeup.permission
#ignore-groups=admins,mods
#on-use=deny,tell

# Deny some ore
#[coalore,goldore,ironore]
#[coal_ore,gold_ore,iron_ore]
#ignore-groups=admins,mods
#on-break=notify,deny,log

# Some funky data value tests
#[wood:0;>=2]
#ignore-groups=admins,mods
#on-break=notify,deny,log

0 comments on commit 1fd94a3

Please sign in to comment.
You can’t perform that action at this time.