mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-25 01:21:21 +01:00
Added Flags display mode chart in Metrics
This commit is contained in:
parent
44d406bcbd
commit
98e6468386
@ -7,6 +7,7 @@ import org.bstats.bukkit.Metrics;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||
import world.bentobox.bentobox.api.flags.Flag;
|
||||
|
||||
/**
|
||||
* @author Poslovitch
|
||||
@ -42,6 +43,7 @@ public class BStats {
|
||||
registerGameModeAddonsChart();
|
||||
registerHooksChart();
|
||||
registerPlayersPerServerChart();
|
||||
registerFlagsDisplayModeChart();
|
||||
|
||||
// Single Line charts
|
||||
registerIslandsCountChart();
|
||||
@ -134,4 +136,25 @@ public class BStats {
|
||||
else return "201+";
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the "flags display mode" of all the online players.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
private void registerFlagsDisplayModeChart() {
|
||||
metrics.addCustomChart(new Metrics.AdvancedPie("flagsDisplayMode", () -> {
|
||||
Map<String, Integer> values = new HashMap<>();
|
||||
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
Flag.Mode mode = plugin.getPlayers().getFlagsDisplayMode(player.getUniqueId());
|
||||
if (values.containsKey(mode.name())) {
|
||||
values.put(mode.name(), values.get(mode.name()) + 1);
|
||||
} else {
|
||||
values.put(mode.name(), 1);
|
||||
}
|
||||
});
|
||||
|
||||
return values;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user