mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-23 01:27:40 +01:00
Switch blacklist to drilldown since bstats doesn't support bar charts.
See https://github.com/Bastian/bStats/issues/67 Also update blacklist example txt with correct names.
This commit is contained in:
parent
c413cf4123
commit
1fd94a3655
@ -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]
|
||||
#ignore-groups=admins,mods
|
||||
#on-break=notify,deny,log
|
||||
|
||||
# Some funky data value tests
|
||||
#[wood:0;>=2]
|
||||
#[coal_ore,gold_ore,iron_ore]
|
||||
#ignore-groups=admins,mods
|
||||
#on-break=notify,deny,log
|
Loading…
Reference in New Issue
Block a user