From c513014732cc94473c746d3db5be33f773c417ca Mon Sep 17 00:00:00 2001 From: KHobbits Date: Thu, 15 Mar 2012 08:08:25 +0000 Subject: [PATCH] Graph a little bit extra information. --- .../src/com/earth2me/essentials/Jails.java | 13 +++++ .../com/earth2me/essentials/api/IJails.java | 2 + .../essentials/metrics/MetricsStarter.java | 54 ++++++++++++++++++- .../essentials/perm/PermissionsHandler.java | 5 ++ 4 files changed, 73 insertions(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/Jails.java b/Essentials/src/com/earth2me/essentials/Jails.java index 7ca4d3bcd..65f486f42 100644 --- a/Essentials/src/com/earth2me/essentials/Jails.java +++ b/Essentials/src/com/earth2me/essentials/Jails.java @@ -146,6 +146,19 @@ public class Jails extends AsyncStorageObjectHolder getList() throws Exception; + int getCount(); + void removeJail(String jail) throws Exception; void sendToJail(com.earth2me.essentials.IUser user, String jail) throws Exception; diff --git a/Essentials/src/com/earth2me/essentials/metrics/MetricsStarter.java b/Essentials/src/com/earth2me/essentials/metrics/MetricsStarter.java index ddd4c197c..83ad84337 100644 --- a/Essentials/src/com/earth2me/essentials/metrics/MetricsStarter.java +++ b/Essentials/src/com/earth2me/essentials/metrics/MetricsStarter.java @@ -3,7 +3,7 @@ package com.earth2me.essentials.metrics; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.metrics.Metrics.Graph; import com.earth2me.essentials.metrics.Metrics.Plotter; -import java.io.IOException; +import com.earth2me.essentials.register.payment.Method; import java.util.Locale; import java.util.logging.Level; @@ -84,6 +84,14 @@ public class MetricsStarter implements Runnable return ess.getUserMap().getUniqueUsers(); } }); + featureGraph.addPlotter(new Plotter("Jails") + { + @Override + public int getValue() + { + return ess.getJails().getCount(); + } + }); featureGraph.addPlotter(new Plotter("Kits") { @Override @@ -101,6 +109,50 @@ public class MetricsStarter implements Runnable } }); + final Graph enabledGraph = metrics.createGraph("EnabledFeatures"); + enabledGraph.addPlotter(new SimplePlotter("Total")); + final String BKcommand = ess.getSettings().getBackupCommand(); + if (BKcommand != null && !"".equals(BKcommand)) + { + enabledGraph.addPlotter(new SimplePlotter("Backup")); + } + if (ess.getJails().getCount() > 0) + { + enabledGraph.addPlotter(new SimplePlotter("Jails")); + } + if (ess.getSettings().getKits().getKeys(false).size() > 0) + { + enabledGraph.addPlotter(new SimplePlotter("Kits")); + } + if (ess.getWarps().getWarpNames().size() > 0) + { + enabledGraph.addPlotter(new SimplePlotter("Warps")); + } + if (!ess.getSettings().areSignsDisabled()) + { + enabledGraph.addPlotter(new SimplePlotter("Signs")); + } + if (ess.getSettings().getAutoAfk() > 0) + { + enabledGraph.addPlotter(new SimplePlotter("AutoAFK")); + } + if (ess.getSettings().changeDisplayName()) + { + enabledGraph.addPlotter(new SimplePlotter("DisplayName")); + } + if (ess.getSettings().getChatRadius() >= 1) + { + enabledGraph.addPlotter(new SimplePlotter("LocalChat")); + } + + final Graph depGraph = metrics.createGraph("Dependancies"); + Method method = ess.getPaymentMethod().getMethod(); + if (method != null) + { + depGraph.addPlotter(new SimplePlotter(method.getName() + " " + method.getVersion())); + } + depGraph.addPlotter(new SimplePlotter(ess.getPermissionsHandler().getName())); + metrics.start(); } diff --git a/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java b/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java index a344968c2..e1bf13d10 100644 --- a/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java +++ b/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java @@ -210,4 +210,9 @@ public class PermissionsHandler implements IPermissionsHandler { this.useSuperperms = useSuperperms; } + + public String getName() + { + return handler.getClass().getSimpleName().replace("Handler", ""); + } }