Skip to content
Adamki11s edited this page Jan 29, 2012 · 2 revisions

< Home

Sync supports internal plugin statistics. I plan to make this global so developers can see their stats but as of now stats will only be seen locally.

To create a statistic service (Register on onEnable()).


StatisticService ss;
 
public void onEnable(){
    this.ss = new StatisticService(this);
}

With the statistic service you can register every command and even add your own statistics.


StatisticService ss;
 
public void onEnable(){
    this.ss = new StatisticService(this);
    this.ss.addCustomStatistic("CustomEvent");
}

public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
    this.ss.commandExecuted(); //Increments the commands executed statistic locally
    return false;
}

public void onCustomEvent(){
    this.ss.incrementStatistic("CustomEvent");
    this.ss.decrementStatistic("CustomEvent");
    this.ss.editStatistic("CustomEvent", 100);
    //any and all of these 3 methods can be used for a custom statistic.
}

Clone this wiki locally