use of org.bstats.bukkit.Metrics in project WildernessTp by AcmeProject.
the class WildTP method wildMetrics.
public void wildMetrics() {
try {
new Metricsa(this).start();
} catch (IOException e) {
}
try {
Metrics metrics = new Metrics(this, 3316);
metrics.addCustomChart(new Metrics.SimplePie("bukkit_impl", new Callable<String>() {
@Override
public String call() throws Exception {
return getServer().getVersion().split("-")[1];
}
}));
for (final String key : getConfig().getKeys(false)) {
if (getConfig().isBoolean(key) && !getConfig().isInt(key) && !getConfig().isString(key))
metrics.addCustomChart(new Metrics.SimplePie(key.toLowerCase(), new Callable<String>() {
@Override
public String call() throws Exception {
return getConfig().getString(key);
}
}));
}
} catch (Throwable rock) {
}
}
use of org.bstats.bukkit.Metrics in project VoxelGamesLibv2 by VoxelGamesLib.
the class MetricHandler method enable.
@Override
public void enable() {
try {
metrics = new Metrics(voxelGamesLib);
// TODO add custom charts, like user/gamemode, installed gamesmodes, user/lang, installed langs etc
// gamemodes multiline TODO enable this on the bstats page once its implemented....
metrics.addCustomChart(new Metrics.MultiLineChart("gamemodes", () -> {
Map<String, Integer> valueMap = new HashMap<>();
gameHandler.getGameModes().forEach((gm) -> valueMap.put(gm.getName(), 1));
return valueMap;
}));
} catch (Throwable ex) {
log.warning("Metrics failed to enabled. This is not a critical problem. You can ignore it.");
}
}
use of org.bstats.bukkit.Metrics in project ServerSelectorX by ServerSelectorX.
the class Stats method initialize.
public static void initialize() {
final Metrics metrics = new Metrics(Main.getPlugin());
metrics.addCustomChart(new Metrics.SimplePie("placeholderapi", () -> {
if (Main.PLACEHOLDER_API instanceof PlaceholdersEnabled) {
return "yes";
} else {
return "no";
}
}));
metrics.addCustomChart(new Metrics.SimplePie("number_of_selectors", () -> {
return Main.getConfigurationManager().getAll().size() + "";
}));
metrics.addCustomChart(new Metrics.AdvancedPie("selector_item", () -> {
final Map<String, Integer> map = new HashMap<>();
for (final FileConfiguration config : Main.getConfigurationManager().getAll()) {
final Material material = Material.getMaterial(config.getString("item"));
// Do not count invalid items
if (material == null)
continue;
if (map.containsKey(material.toString())) {
map.put(material.toString(), map.get(material.toString() + 1));
} else {
map.put(material.toString(), 1);
}
}
return map;
}));
metrics.addCustomChart(new Metrics.AdvancedPie("type", () -> {
final Map<String, Integer> map = new HashMap<>();
for (final FileConfiguration config : Main.getConfigurationManager().getAll()) {
for (final String slot : config.getConfigurationSection("menu").getKeys(false)) {
String action = config.getString("menu." + slot + ".action").split(":")[0].toLowerCase();
if (map.containsKey(action)) {
map.put(action, map.get(action) + 1);
} else {
map.put(action, 1);
}
}
}
return map;
}));
metrics.addCustomChart(new Metrics.SimplePie("ping_api", () -> {
if (Main.getPlugin().getConfig().getBoolean("external-query", true)) {
return "External";
} else {
return "Internal";
}
}));
metrics.addCustomChart(new Metrics.SimplePie("updater", () -> {
if (Main.getPlugin().getConfig().getBoolean("updater", true)) {
return "Enabled";
} else {
return "Disabled";
}
}));
metrics.addCustomChart(new Metrics.SimplePie("player_count_mode", () -> {
return Main.getPlugin().getConfig().getString("item-count-mode", "absolute").toLowerCase();
}));
metrics.addCustomChart(new Metrics.SimplePie("background_pinging", () -> {
if (Main.getPlugin().getConfig().getBoolean("background-pinging", true)) {
return "Enabled";
} else {
return "Disabled";
}
}));
metrics.addCustomChart(new Metrics.AdvancedPie("server_pinging", () -> {
final Map<String, Integer> map = new HashMap<>();
for (final FileConfiguration config : Main.getConfigurationManager().getAll()) {
for (final String slot : config.getConfigurationSection("menu").getKeys(false)) {
String action = config.getString("menu." + slot + ".action").split(":")[0].toLowerCase();
if (action.equalsIgnoreCase("srv")) {
if (config.getBoolean("menu." + slot + ".ping-server", false)) {
if (map.containsKey("Enabled")) {
map.put("Enabled", map.get("Enabled") + 1);
} else {
map.put("Enabled", 1);
}
} else {
if (map.containsKey("Disabled")) {
map.put("Disabled", map.get("Disabled") + 1);
} else {
map.put("Disabled", 1);
}
}
}
}
}
return map;
}));
metrics.addCustomChart(new Metrics.SimplePie("permissions", () -> {
if (Main.getPlugin().getConfig().getBoolean("permissions-enabled", false)) {
return "Enabled";
} else {
return "Disabled";
}
}));
metrics.addCustomChart(new Metrics.SimplePie("item_drop", () -> {
if (Main.getPlugin().getConfig().getBoolean("cancel-item-drop", false)) {
return "Cancel";
} else {
return "Allow";
}
}));
metrics.addCustomChart(new Metrics.SimplePie("item_move", () -> {
if (Main.getPlugin().getConfig().getBoolean("cancel-item-move", false)) {
return "Cancel";
} else {
return "Allow";
}
}));
metrics.addCustomChart(new Metrics.AdvancedPie("menu_item_slot", () -> {
final Map<String, Integer> map = new HashMap<>();
for (final FileConfiguration config : Main.getConfigurationManager().getAll()) {
int slot = config.getInt("inv-slot", 0);
if (slot < 0) {
if (map.containsKey("Auto")) {
map.put("Auto", map.get("Auto") + 1);
} else {
map.put("Auto", 1);
}
} else {
if (map.containsKey(slot + "")) {
map.put(slot + "", map.get(slot + "") + 1);
} else {
map.put(slot + "", 1);
}
}
}
return map;
}));
metrics.addCustomChart(new Metrics.AdvancedPie("rows", () -> {
final Map<String, Integer> map = new HashMap<>();
for (final FileConfiguration config : Main.getConfigurationManager().getAll()) {
int rows = config.getInt("rows", 6);
if (map.containsKey(rows + "")) {
map.put(rows + "", map.get(rows + "") + 1);
} else {
map.put(rows + "", 1);
}
}
return map;
}));
}
use of org.bstats.bukkit.Metrics in project Prism-Bukkit by prism.
the class Prism method checkPluginDependencies.
private void checkPluginDependencies() {
// DripReporter
ApiHandler.configureMonitor();
// WorldEdit
ApiHandler.hookWorldEdit();
// bstats
if (getConfig().getBoolean("prism.allow-metrics")) {
Prism.log("Prism bStats metrics are enabled - thank you!");
// assigned by bstats.org
int pluginId = 4365;
Metrics metrics = new Metrics(this, pluginId);
if (!metrics.isEnabled()) {
Prism.warn("bStats failed to initialise! Please check Prism/bStats configs.");
}
Metrics.MultiLineChart blockBreaksHour = new Metrics.MultiLineChart("//TODO", ActionMeter::getMetricMeter);
metrics.addCustomChart(blockBreaksHour);
}
}
use of org.bstats.bukkit.Metrics in project AuthMeReloaded by AuthMe.
the class OnStartupTasks method sendMetrics.
/**
* Sends bstats metrics.
*
* @param plugin the plugin instance
* @param settings the settings
*/
public static void sendMetrics(AuthMe plugin, Settings settings) {
final Metrics metrics = new Metrics(plugin, 164);
metrics.addCustomChart(new SimplePie("messages_language", () -> settings.getProperty(PluginSettings.MESSAGES_LANGUAGE)));
metrics.addCustomChart(new SimplePie("database_backend", () -> settings.getProperty(DatabaseSettings.BACKEND).toString()));
}
Aggregations