mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-13 10:04:51 +02:00
Adding some simple feature metrics.
This commit is contained in:
@@ -2,7 +2,9 @@ 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 java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
|
||||||
@@ -64,17 +66,39 @@ public class MetricsStarter implements Runnable
|
|||||||
final String moduleName = module.toString();
|
final String moduleName = module.toString();
|
||||||
if (ess.getServer().getPluginManager().isPluginEnabled(moduleName))
|
if (ess.getServer().getPluginManager().isPluginEnabled(moduleName))
|
||||||
{
|
{
|
||||||
moduleGraph.addPlotter(new Metrics.Plotter(moduleName)
|
moduleGraph.addPlotter(new SimplePlotter(moduleName));
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public int getValue()
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Graph localeGraph = metrics.createGraph("Locale");
|
||||||
|
localeGraph.addPlotter(new SimplePlotter(ess.getI18n().getCurrentLocale().getDisplayLanguage(Locale.ENGLISH)));
|
||||||
|
|
||||||
|
Graph featureGraph = metrics.createGraph("Features");
|
||||||
|
featureGraph.addPlotter(new Plotter("Unique Accounts")
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public int getValue()
|
||||||
|
{
|
||||||
|
return ess.getUserMap().getUniqueUsers();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
featureGraph.addPlotter(new Plotter("Kits")
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public int getValue()
|
||||||
|
{
|
||||||
|
return ess.getSettings().getKits().getKeys(false).size();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
featureGraph.addPlotter(new Plotter("Warps")
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public int getValue()
|
||||||
|
{
|
||||||
|
return ess.getWarps().getWarpNames().size();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
metrics.start();
|
metrics.start();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -100,4 +124,19 @@ public class MetricsStarter implements Runnable
|
|||||||
{
|
{
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private class SimplePlotter extends Plotter
|
||||||
|
{
|
||||||
|
public SimplePlotter(final String name)
|
||||||
|
{
|
||||||
|
super(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getValue()
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user