API Usage metrics data

This commit is contained in:
Adam committed 2012-05-28 21:01:02 -04:00
1 parent a484e6b3d4
commit fd93bc8ef2
2 files changed
+37 -2

No files matched your search

@@ -163,10 +163,10 @@ public class Anticheat extends JavaPlugin
{
metrics = new Metrics(this);
final EventListener listener = new EventListener();
Graph graph = metrics.createGraph("Hacks blocked");
Graph hacksGraph = metrics.createGraph("Hacks blocked");
for (final CheckType type : CheckType.values())
{
graph.addPlotter(new Metrics.Plotter(CheckType.getName(type))
hacksGraph.addPlotter(new Metrics.Plotter(CheckType.getName(type))
{
@Override
public int getValue()
@@ -176,6 +176,23 @@ public class Anticheat extends JavaPlugin
});
listener.resetCheck(type);
}
Graph apiGraph = metrics.createGraph("API Usage");
apiGraph.addPlotter(new Metrics.Plotter("Checks disabled")
{
@Override
public int getValue()
{
return manager.getCheckManager().getDisabled();
}
});
apiGraph.addPlotter(new Metrics.Plotter("Players exempted")
{
@Override
public int getValue()
{
return manager.getCheckManager().getExempt();
}
});
metrics.start();
if (verbose)
{
@@ -34,6 +34,8 @@ public class CheckManager
public AnticheatManager manager = null;
private static List<CheckType> checkIgnoreList = new ArrayList<CheckType>();
private static Multimap<String,CheckType> exemptList = ArrayListMultimap.create();
private static int disabled = 0;
private static int exempt = 0;
public CheckManager(AnticheatManager instance)
{
@@ -53,6 +55,7 @@ public class CheckManager
{
manager.log("The "+type.toString()+" check was deactivated.");
checkIgnoreList.add(type);
disabled++;
}
public boolean isActive(CheckType type)
@@ -64,6 +67,7 @@ public class CheckManager
{
manager.log(player.getName()+" was exempted from the "+type.toString()+" check.");
exemptList.put(player.getName(), type);
exempt++;
}
public void unexemptPlayer(Player player, CheckType type)
@@ -92,4 +96,18 @@ public class CheckManager
&& !isExempt(player, type)
&& !hasPermission(player, type.getPermission());
}
public int getExempt()
{
int x = exempt;
exempt = 0;
return x;
}
public int getDisabled()
{
int x = disabled;
disabled = 0;
return x;
}
}