Graph a little bit extra information.

This commit is contained in:
KHobbits 2012-03-15 08:08:25 +00:00
parent bada36be68
commit c513014732
4 changed files with 73 additions and 1 deletions

View file

@ -146,6 +146,19 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
} }
} }
@Override
public int getCount()
{
try
{
return getList().size();
}
catch (Exception ex)
{
return 0;
}
}
private class JailBlockListener implements Listener private class JailBlockListener implements Listener
{ {

View file

@ -10,6 +10,8 @@ public interface IJails extends IReload
Collection<String> getList() throws Exception; Collection<String> getList() throws Exception;
int getCount();
void removeJail(String jail) throws Exception; void removeJail(String jail) throws Exception;
void sendToJail(com.earth2me.essentials.IUser user, String jail) throws Exception; void sendToJail(com.earth2me.essentials.IUser user, String jail) throws Exception;

View file

@ -3,7 +3,7 @@ package com.earth2me.essentials.metrics;
import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.metrics.Metrics.Graph; import com.earth2me.essentials.metrics.Metrics.Graph;
import com.earth2me.essentials.metrics.Metrics.Plotter; 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.Locale;
import java.util.logging.Level; import java.util.logging.Level;
@ -84,6 +84,14 @@ public class MetricsStarter implements Runnable
return ess.getUserMap().getUniqueUsers(); return ess.getUserMap().getUniqueUsers();
} }
}); });
featureGraph.addPlotter(new Plotter("Jails")
{
@Override
public int getValue()
{
return ess.getJails().getCount();
}
});
featureGraph.addPlotter(new Plotter("Kits") featureGraph.addPlotter(new Plotter("Kits")
{ {
@Override @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(); metrics.start();
} }

View file

@ -210,4 +210,9 @@ public class PermissionsHandler implements IPermissionsHandler
{ {
this.useSuperperms = useSuperperms; this.useSuperperms = useSuperperms;
} }
public String getName()
{
return handler.getClass().getSimpleName().replace("Handler", "");
}
} }