use of org.bstats.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);
metrics.addCustomChart(new Metrics.SimplePie("messages_language") {
@Override
public String getValue() {
return settings.getProperty(PluginSettings.MESSAGES_LANGUAGE);
}
});
metrics.addCustomChart(new Metrics.SimplePie("database_backend") {
@Override
public String getValue() {
return settings.getProperty(DatabaseSettings.BACKEND).toString();
}
});
}
use of org.bstats.Metrics in project AreaShop by NLthijs48.
the class Analytics method start.
/**
* Start analytics tracking.
*/
public static void start() {
// Legacy MCstats statistics (remove at some point)
try {
new me.wiefferink.areashop.lib.Metrics(AreaShop.getInstance()).start();
AreaShop.debug("Started mcstats.org statistics service");
} catch (Exception e) {
AreaShop.debug("Could not start mcstats.org statistics service");
}
// bStats statistics
try {
Metrics metrics = new Metrics(AreaShop.getInstance());
// Number of regions
metrics.addCustomChart(new Metrics.SingleLineChart("region_count") {
@Override
public int getValue() {
return AreaShop.getInstance().getFileManager().getRegions().size();
}
});
// Number of rental regions
metrics.addCustomChart(new Metrics.SingleLineChart("rental_region_count") {
@Override
public int getValue() {
return AreaShop.getInstance().getFileManager().getRents().size();
}
});
// Number of buy regions
metrics.addCustomChart(new Metrics.SingleLineChart("buy_region_count") {
@Override
public int getValue() {
return AreaShop.getInstance().getFileManager().getBuys().size();
}
});
// Language
metrics.addCustomChart(new Metrics.SimplePie("language") {
@Override
public String getValue() {
return AreaShop.getInstance().getConfig().getString("language");
}
});
// Pie with region states
metrics.addCustomChart(new Metrics.AdvancedPie("region_state") {
@Override
public HashMap<String, Integer> getValues(HashMap<String, Integer> result) {
RegionStateStats stats = getStateStats();
result.put("For Rent", stats.forrent);
result.put("Rented", stats.rented);
result.put("For Sale", stats.forsale);
result.put("Sold", stats.sold);
result.put("Reselling", stats.reselling);
return result;
}
});
// Time series of each region state
metrics.addCustomChart(new Metrics.SingleLineChart("forrent_region_count") {
@Override
public int getValue() {
return getStateStats().forrent;
}
});
metrics.addCustomChart(new Metrics.SingleLineChart("rented_region_count") {
@Override
public int getValue() {
return getStateStats().rented;
}
});
metrics.addCustomChart(new Metrics.SingleLineChart("forsale_region_count") {
@Override
public int getValue() {
return getStateStats().forsale;
}
});
metrics.addCustomChart(new Metrics.SingleLineChart("sold_region_count") {
@Override
public int getValue() {
return getStateStats().sold;
}
});
metrics.addCustomChart(new Metrics.SingleLineChart("reselling_region_count") {
@Override
public int getValue() {
return getStateStats().reselling;
}
});
// TODO track rent/buy/unrent/sell/resell actions (so that it can be reported per collection interval)
AreaShop.debug("Started bstats.org statistics service");
} catch (Exception e) {
AreaShop.debug("Could not start bstats.org statistics service");
}
}
use of org.bstats.Metrics in project MagicPlugin by elBukkit.
the class MagicController method activateMetrics.
protected void activateMetrics() {
// Activate Metrics
final MagicController controller = this;
metrics = null;
if (metricsLevel > 0) {
try {
metrics = new Metrics(plugin);
if (metricsLevel > 1) {
metrics.addCustomChart(new Metrics.MultiLineChart("Plugin Integration") {
@Override
public HashMap<String, Integer> getValues(HashMap<String, Integer> valueMap) {
valueMap.put("Essentials", controller.hasEssentials ? 1 : 0);
valueMap.put("Dynmap", controller.hasDynmap ? 1 : 0);
valueMap.put("Factions", controller.factionsManager.isEnabled() ? 1 : 0);
valueMap.put("WorldGuard", controller.worldGuardManager.isEnabled() ? 1 : 0);
valueMap.put("Elementals", controller.elementalsEnabled() ? 1 : 0);
valueMap.put("Citizens", controller.citizens != null ? 1 : 0);
valueMap.put("CommandBook", controller.hasCommandBook ? 1 : 0);
valueMap.put("PvpManager", controller.pvpManager.isEnabled() ? 1 : 0);
valueMap.put("Multiverse-Core", controller.multiverseManager.isEnabled() ? 1 : 0);
valueMap.put("Towny", controller.townyManager.isEnabled() ? 1 : 0);
valueMap.put("GriefPrevention", controller.griefPreventionManager.isEnabled() ? 1 : 0);
valueMap.put("PreciousStones", controller.preciousStonesManager.isEnabled() ? 1 : 0);
valueMap.put("Lockette", controller.locketteManager.isEnabled() ? 1 : 0);
valueMap.put("NoCheatPlus", controller.ncpManager.isEnabled() ? 1 : 0);
return valueMap;
}
});
metrics.addCustomChart(new Metrics.MultiLineChart("Features Enabled") {
@Override
public HashMap<String, Integer> getValues(HashMap<String, Integer> valueMap) {
valueMap.put("Crafting", controller.crafting.isEnabled() ? 1 : 0);
valueMap.put("Enchanting", controller.enchanting.isEnabled() ? 1 : 0);
valueMap.put("SP", controller.isSPEnabled() ? 1 : 0);
return valueMap;
}
});
}
if (metricsLevel > 2) {
metrics.addCustomChart(new Metrics.MultiLineChart("Total Casts by Category") {
@Override
public HashMap<String, Integer> getValues(HashMap<String, Integer> valueMap) {
for (final SpellCategory category : categories.values()) {
valueMap.put(category.getName(), (int) category.getCastCount());
}
return valueMap;
}
});
}
if (metricsLevel > 3) {
metrics.addCustomChart(new Metrics.MultiLineChart("Total Casts") {
@Override
public HashMap<String, Integer> getValues(HashMap<String, Integer> valueMap) {
for (final SpellTemplate spell : spells.values()) {
if (!(spell instanceof Spell))
continue;
valueMap.put(spell.getName(), (int) ((Spell) spell).getCastCount());
}
return valueMap;
}
});
}
plugin.getLogger().info("Activated BStats");
} catch (Exception ex) {
plugin.getLogger().warning("Failed to load BStats: " + ex.getMessage());
}
}
}
Aggregations